Git: Create a new local branch and set up remote tracking

If you want to create a new branch in Git, and set it up so it's tracked upstream also do this:

git checkout -b branch_name
git push -u origin branch_name

git push -u handles setting the upstream, as well as setting the local branch to track the remote branch.

Leave A Reply
All content licensed under the Creative Commons License