How is @ {push} different from @ {u} or the tracking branch?

According to Git 2.5.0 release notes:

A new short <branch>@{push} denotes a remote tracking branch that tracks the branch on the remote control that the button will be pressed on.

How is this different from <branch>@{u} (for an upstream branch) or even just doing $ git push without parameters when setting up the correct tracking branch?

+5
source share
1 answer

Here is the relevant documentation, from git help rev-parse :

  <branchname>@{push}, eg master@ {push}, @{push} The suffix @{push} reports the branch "where we would push to" if git push were run while branchname was checked out (or the current HEAD if no branchname is specified). Since our push destination is in a remote repository, of course, we report the local tracking branch that corresponds to that branch (ie, something in refs/remotes/). Here an example to make it more clear: $ git config push.default current $ git config remote.pushdefault myfork $ git checkout -b mybranch origin/master $ git rev-parse --symbolic-full-name @{upstream} refs/remotes/origin/master $ git rev-parse --symbolic-full-name @{push} refs/remotes/myfork/mybranch Note in the example that we set up a triangular workflow, where we pull from one location and push to another. In a non-triangular workflow, @{push} is the same as @{upstream}, and there is no need for it. 

This way, they will be different if the upstream tracking branch is on a different remote server than the one you configured to push by default.

+2
source

All Articles