Skip to content

Instantly share code, notes, and snippets.

@syropian
Last active December 18, 2015 14:49
Show Gist options
  • Save syropian/5800352 to your computer and use it in GitHub Desktop.
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.
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