Read more

Git: Push a new branch and track it immediately

Arne Hartherz
April 05, 2012Software engineer at makandra GmbH

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.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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).

Posted by Arne Hartherz to makandra dev (2012-04-05 13:38)