HOW TO: Setup a new local & remote Git Branch
A question came up in the office today:
What’s the best way to create a new tracking branch both locally and on the server?
Steve decided this 2-liner was best:
git checkout -b newBranch
git push -u origin newBranch
Have a better way? Let us know!
Comments
I love the git_remote_branch gem.
grb create and you are done.
If you set branch.autosetupmerge = true you can avoid the -u I think. But you still need the two commands.
Deleting a remote branch is kinda clunky using pure git. grb makes sense there (even though I don’t use it).