Last active
December 18, 2015 14:49
-
-
Save syropian/5800352 to your computer and use it in GitHub Desktop.
Add this to your bash profile if you want to easily create a remote branch and then checkout a local branch that tracks it.
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
function git-cb() { | |
if [ $# -ne 1 ]; then | |
echo 1>&2 Usage: git-cb branch_name | |
else | |
git push origin origin:refs/heads/$1 | |
git fetch origin | |
git checkout --track -b $1 origin/$1 | |
git pull | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment