Created
April 8, 2019 07:35
-
-
Save abuseofnotation/26f7d626e7ad6f424ceb86634c4d769f to your computer and use it in GitHub Desktop.
An interactive command for switching branches.
This file contains hidden or 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
[alias] | |
switch = "!branchesString=$(git for-each-ref --sort=-committerdate --count=10 --format='%(refname:short),' refs/heads/) && branches=(${branchesString//,/ }) && for i in ${!branches[@]}; do echo \"$i - ${branches[$i]}\"; done && read -p which: branch && git checkout ${branches[$branch]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment