there are different types of branches:
Here, branch_name
is a local branch, whereas origin/branch_name
is a remote-tracking branch; it reflects the state of the corresponding branch that lives in origin
.
Right after running
git fetch
the remote-tracking branch origin/master
and the corresponding branch that live in origin
should be perfectly in sync (modulo concurrent pushes to the remote server, of course). It shouldn't be a surprise, then, that
git push origin origin/branch_name
doesn't push anything: you're essentially attempting to push stuff that is already present in the ancestry of the corresponding branch that live in origin
.
However, if your local branch, branch_name
, is ahead by one or more commits,
then running
git push origin branch_name
will push the commits contained in branch_name
but not in the branch that live in origin
: