Skip to content

Instantly share code, notes, and snippets.

@josephgrossberg
Created May 25, 2011 17:28
Show Gist options
  • Save josephgrossberg/991425 to your computer and use it in GitHub Desktop.
Save josephgrossberg/991425 to your computer and use it in GitHub Desktop.
Remote branch creation without editing config file
function gitbranch {
git checkout -b "$1";
git push -u origin "$1";
}
#######################
# create local branch
git branch foo
# push local branch to remote
git push origin foo
# delete local branch!
git branch -d foo
# checkout remote branch, which auto-creates a local, remote-tracking branch and switches to it
git checkout foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment