Reputation: 5264
I have a branch sf
locally and a branch serverfix
on remote.
The output of git remote show origin
:
* remote origin
Fetch URL: [email protected]:pr0g4amtest1ng/git-remote.git
Push URL: [email protected]:pr0g4amtest1ng/git-remote.git
HEAD branch: master
Remote branches:
master tracked
serverfix tracked
Local branches configured for 'git pull':
master merges with remote master
sf merges with remote serverfix
Local ref configured for 'git push':
master pushes to master (up to date)
To make things easy for git push
, I did the following:
git config push.default upstream
git push -u
Now if I run git remote show origin
again
* remote origin
Fetch URL: [email protected]:pr0g4amtest1ng/git-remote.git
Push URL: [email protected]:pr0g4amtest1ng/git-remote.git
HEAD branch: master
Remote branches:
master tracked
serverfix tracked
Local branches configured for 'git pull':
master merges with remote master
sf merges with remote serverfix
Local ref configured for 'git push':
master pushes to master (up to date)
Strangely Local ref configured for 'git push': didn't change at all.
Shouldn't it add an entry like sf pushes to serverfix (up to date)
or something like that.
But if I do git push origin sf
, it gives Everything up-to-date
and it is not creating an sf
branch on remote anymore, that means it is tracking.
How will I know which branch are being tracked for 'git push' ? Why there isn't an entry added for Local ref configured for 'git push': or when an entry will be added for that matter.
Upvotes: 2
Views: 1141
Reputation: 2549
You have two choices
First choice:
git config remote.origin.push <local_branch_refs>:<remote_branch_refs>
Second choice:
git config --edit
to edit the .git/config
file.
[remote "origin"]
push =<local_branch_refs>:<remote_branch_refs>
For your case, it should be:
git config remote.origin.push refs/heads/sf:/refs/heads/serverfix
After that, you can see the updates in Local ref configured for 'git push' section by git remote show origin
.
Upvotes: 2
Reputation: 94707
push.default = upstream: push the current branch…
To list branches with their upstreams: git branch -vv
.
Upvotes: 0