git push doesn't update the status with multiple remotes
Hello,
I'm using git 1.9.1 in Ubuntu 14.04.
I have a repository on github, a clone on my desktop and bare repo on a private server, in my desktop the remotes looks like this
all [email protected]:user/repo.git (fetch)
all [email protected]:user/repo.git (push)
all [email protected]:user/repo.git (push)
server [email protected]:user/repo.git (fetch)
server [email protected]:user/repo.git (push)
origin [email protected]:user/repo.git (fetch)
origin [email protected]:user/repo.git (push)
If I commit to master in my desktop and run 'git push all master', the github and the server repos are correctly updated, but if I run 'git status' the message says:
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
The message won't update unless I run git fetch or git push origin master.
I'd expect the git status to give me a updated status message after calling 'git push all master'.
Best regards,
Garoe
Am 11.07.2016 um 18:54 schrieb Garoe:
Quoted 11 lines
I have a repository on github, a clone on my desktop and bare repo on a private server, in my desktop the remotes looks like this
all [email protected]:user/repo.git (fetch) all [email protected]:user/repo.git (push) all [email protected]:user/repo.git (push) server [email protected]:user/repo.git (fetch) server [email protected]:user/repo.git (push) origin [email protected]:user/repo.git (fetch) origin [email protected]:user/repo.git (push)
Quoted 6 lines
If I commit to master in my desktop and run 'git push all master', the github and the server repos are correctly updated, but if I run 'git status' the message says:
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
But "all" and "origin" are different remotes. Just because you use the same URL does not make them the same remote repository from the view of your local repository.
(Additionally, "all" is not a special name, just in case you had expected that.)
Quoted 1 line
The message won't update unless I run git fetch or git push origin master.
Yes, that's how it is supposed to work.
I think there is some way to configure that a single push command pushes to several remote repositories, but I can't find it right now...
-- Hannes
Thanks for the quick reply.
Quoted 16 lines · Johannes Sixt
Am 11.07.2016 um 18:54 schrieb Garoe:
Quoted 15 lines
I have a repository on github, a clone on my desktop and bare repo on a private server, in my desktop the remotes looks like this
all [email protected]:user/repo.git (fetch) all [email protected]:user/repo.git (push) all [email protected]:user/repo.git (push) server [email protected]:user/repo.git (fetch) server [email protected]:user/repo.git (push) origin [email protected]:user/repo.git (fetch) origin [email protected]:user/repo.git (push)If I commit to master in my desktop and run 'git push all master', the github and the server repos are correctly updated, but if I run 'git status' the message says:
Quoted 6 lines
Quoted 2 lines
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)But "all" and "origin" are different remotes. Just because you use the same URL does not make them the same remote repository from the view of your local repository.
I expected git to be "intelligent" enough to detect that if the url are the same, it had already exchanged information with the server by the push command, so it would update the message without explicitly pushing to origin.
Quoted 8 lines
(Additionally, "all" is not a special name, just in case you had expected that.)
Quoted 2 lines
The message won't update unless I run git fetch or git push origin master.
Yes, that's how it is supposed to work.
From my point of view the current behaviour is counter-intuitive. Anyhow, I understand by your answer that the current behaviour is desired and it won't be changed.
Quoted 5 lines
I think there is some way to configure that a single push command pushes to several remote repositories, but I can't find it right now...
-- Hannes
Thanks again,
Garoe