Git: Push a new branch and track it immediately

Updated . Posted . Visible to the public.

When you create a new branch and push it to origin, you won't be tracking it. This means a git pull won't know its remote version.

You could use difficult commands to set up a branch's tracking but it's easier to just push it like this:

git push -u

From the documentation on git push Show archive.org snapshot :

-u, --set-upstream
For every branch that is up to date or successfully pushed, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch..merge in git-config(1).

Arne Hartherz
Last edit
Arne Hartherz
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2012-04-05 11:38)