Created
May 23, 2013 11:52
-
-
Save mikker/5635538 to your computer and use it in GitHub Desktop.
Checkout new (or existing) branch of name $1 -- with completion
This file contains hidden or 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
nb() { | |
if [[ $(git branch | tr -d '* ' | grep "$1") != "" ]]; then | |
git checkout $1 | |
else | |
git checkout -b $1 | |
fi | |
} | |
_nb() { reply=($(git branch | tr -d '* ' | xargs echo)) } | |
compctl -K _nb nb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment