Skip to content

Instantly share code, notes, and snippets.

@ltw
Created May 7, 2014 15:54
Show Gist options
  • Select an option

  • Save ltw/c40accc2ea50265a0af4 to your computer and use it in GitHub Desktop.

Select an option

Save ltw/c40accc2ea50265a0af4 to your computer and use it in GitHub Desktop.
This is a rough first-pass implementation at a `git checkout` alias that matches on partial branch names. I'd ideally like to make this a little nicer and/or fuzzy-matching.
gcof () {
git branch | cut -c 3-1000 | grep $1 | head -1 | xargs git checkout
}
# $ git branch
# * master
# remember-the-fifth-of-november
# $ gcof fifth
# Switched to branch 'remember-the-fifth-of-november'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment