According to Git 2.5.0 release notes:
A new short-hand
<branch>@{push}
denotes the remote-tracking branch that tracks the branch at the remote the would be pushed to.
How is this different from <branch>@{u}
(for upstream branch), or even just doing $ git push
with no parameters when a proper tracking branch is set?
Here is the relevant documentation, from git help rev-parse
:
<branchname>@{push}, e.g. 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 (i.e., something in refs/remotes/). Here's 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.
So, they will be different if your upstream tracking branch is on a different remote than the one you've configured to push to by default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With