-
-
Save aflashyrhetoric/91c902e129e193feb45968e487da190f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# lists the branches in order and lets you select | |
# which one to checkout | |
branches=( $(git for-each-ref refs/heads | cut -d '/' -f 3-) ) | |
for i in "${!branches[@]}"; do | |
echo "$i) ${branches[$i]}" | |
done | |
echo -n "Branch number: " | |
read bnum | |
git checkout "${branches[$bnum]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment