Last active
February 1, 2017 18:17
-
-
Save peregrinogris/b10d15ff4896f73e194d to your computer and use it in GitHub Desktop.
Use this to checkout a branch ending with a certain string
This file contains 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
#!/usr/bin/env bash | |
branch=`git branch -a | egrep -io "([^/]+/)?[^/]+$1$" | sed 's/* //' | head -1` | |
git checkout $branch |
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
Store it under
/usr/local/bin/git-usebranch
and add a git alias fromusebranch
touse
, then:git use 440