set selected_branch to text returned of (display dialog ("Select a branch to checkout: " & branches as text) buttons {"Cancel", "Switch"} with title "Checkout Branch" cancel button "Cancel" default button "Switch" default answer "")