Skip to content

Instantly share code, notes, and snippets.

@dangerouse
Created July 24, 2014 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangerouse/4b81080887c7d1ec2807 to your computer and use it in GitHub Desktop.
Save dangerouse/4b81080887c7d1ec2807 to your computer and use it in GitHub Desktop.
Fuzzy git checkout
# given a branch like 750-feature-name
# gcb 750
# sponge $ gcb 750
# checking out 750-feature-name
# Switched to branch '750-feature-name'
function gcb() {
branches=`git branch`
branchName=`echo "$branches" | grep $1`
branchName=`echo "$branchName" | sed s/\*//`
echo "checking out $branchName"
git co $branchName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment