git branch -vv
shows that my local develop
branch is tracking the remote fix/some-bug
branch. However, a git push
command pushed my commits to the remote develop
branch.
WTF?
This is why. There are four options for the behaviour of git push
with no appending arguments:
- matching: push all matching branches. All branches having the same name in both ends are considered to be matching. This is the default.
- tracking: push the current branch to its upstream branch.
- current: push the current branch to a branch of the same name.
- nothing: do not push anything.
You can see what your setting is with:
$ git config push.default
So without additional setting, a simple “git push” command actually pushed all of my local branches to remote ones with the same name.
Now, I want the “tracking” option, so this is what I need to do:
$ git config --global push.default tracking
Reference:
http://stackoverflow.com/questions/3565674/git-remote-branch-tracking