Skip to content

Instantly share code, notes, and snippets.

@peregrinogris
Last active February 1, 2017 18:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peregrinogris/b10d15ff4896f73e194d to your computer and use it in GitHub Desktop.
Save peregrinogris/b10d15ff4896f73e194d to your computer and use it in GitHub Desktop.
Use this to checkout a branch ending with a certain string
#!/usr/bin/env bash
branch=`git branch -a | egrep -io "([^/]+/)?[^/]+$1$" | sed 's/* //' | head -1`
git checkout $branch
@juanrossi
Copy link

To setup alias edit ~/.gitconfig:

[alias]
    use = usebranch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment