Skip to content

Instantly share code, notes, and snippets.

@blackfalcon
Last active September 4, 2018 20:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackfalcon/02f4734867c2a66ac76e87d2f829dfc9 to your computer and use it in GitHub Desktop.
Save blackfalcon/02f4734867c2a66ac76e87d2f829dfc9 to your computer and use it in GitHub Desktop.
Easy Git branch switcher in the CLI
# put this in your .bashrc
function switch() {
git branch | grep "$1" | pbcopy && tmp=$(pbpaste) && git checkout $tmp
}
# example branch ... 8038031-update-things-long-branch-name-of-things
# use in the CLI
# $ switch 38031 (or any unique searchable string)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment