As an added benefit, you will get an informative message on top of "git status" output telling you which one of the two ends has new commits, like this:
Now, this works by default with the master branch but if you created a local branch like:
$ git status # On branch master # Your branch is behind 'origin/master' by 11 commits, and can be fast-forwarded
then decided to push it to origin (or any other remote), tracking will not be active unless you use the command:
$ git checkout -b new_branch Switched to a new branch 'new_branch'
If you forget to use the --set-upstream option during push you can also do it later (from version 1.7) with:
$ git push --set-upstream origin new_branch Counting objects: 40, done. Delta compression using up to 2 threads. Compressing objects: 100% (25/25), done. Writing objects: 100% (25/25), 3.25 KiB, done. Total 25 (delta 19), reused 0 (delta 0) To email@example.com:giallu/testrepo.git dcdb736..643a3f2 new_branch -> new_branch Branch new_branch set up to track remote branch new_branch from origin
$ git --set-upstream origin new_branch