Skip to content

Instantly share code, notes, and snippets.

@wellic
Forked from alecthegeek/gitcomenu.sh
Created June 6, 2016 16:21
Show Gist options
  • Save wellic/4b5c49db9af2b70dc5174adba977c5db to your computer and use it in GitHub Desktop.
Save wellic/4b5c49db9af2b70dc5174adba977c5db to your computer and use it in GitHub Desktop.
Make `git checkout <branch>` into a menu selection
OPS3=$PS3
echo There are multiple branchs in this repo. Please select the one you want to use
PS3='If you're not sure just choose "master" '
select br in $(git branch|sed -e '/^[* ] /s///'); do
[[ -n $br ]] && git checkout $br &&
break
done
PS3=$OPS3
# You can also put this in your git aliases
# com = !"select br in $(git branch|sed -e '/^[* ] /s///'); do [[ -n $br ]] && git checkout $br && break; done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment