* Local branch ahead of tracked remote branch but git push claims everything up-to-date
@ 2008-08-20 20:26 ir0s
2008-08-20 20:37 ` Alex Riesen
2008-08-20 20:40 ` Andreas Färber
0 siblings, 2 replies; 13+ messages in thread
From: ir0s @ 2008-08-20 20:26 UTC (permalink / raw)
To: git
Hello,
I've used git for quite some time now but haven't run into this kind of
issue before.
I created a new branch from a remote branch that me and another developer
share:
$ git checkout --track -b mybranch origin/remotebranch
I make some changes, commit them but then switch to another branch and do
some work there.
I return to checkout my new branch to do some work:
$ git checkout mybranch
Switched to branch "mybranch "
Your branch is ahead of the tracked remote branch 'origin/remotebranch' by 4
commits.
mybranch
Accurately, it has 4 commits that I haven't pushed yet. I try to push them
but I get the following:
$ git push origin remotebranch
Everything up-to-date
Any ideas? This is really strange. Clearly I have missing commits, my
teammate doesn't see those 4 when he pulls and yet I can't add them.
>From my git config:
[branch "mybranch"]
remote = origin
merge = refs/heads/remotebranch
--
View this message in context: http://n2.nabble.com/Local-branch-ahead-of-tracked-remote-branch-but-git-push-claims-everything-up-to-date-tp736663p736663.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 20:26 Local branch ahead of tracked remote branch but git push claims everything up-to-date ir0s
@ 2008-08-20 20:37 ` Alex Riesen
2008-08-20 20:40 ` Andreas Färber
1 sibling, 0 replies; 13+ messages in thread
From: Alex Riesen @ 2008-08-20 20:37 UTC (permalink / raw)
To: ir0s; +Cc: git
ir0s, Wed, Aug 20, 2008 22:26:09 +0200:
> $ git push origin remotebranch
> Everything up-to-date
Just (assuming that tracking information is correct)
git push
or (if you want to be absolutely sure, and be able to find and
understand the fact afterwards in your shells history)
git push origin HEAD:remotebranch
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 20:26 Local branch ahead of tracked remote branch but git push claims everything up-to-date ir0s
2008-08-20 20:37 ` Alex Riesen
@ 2008-08-20 20:40 ` Andreas Färber
2008-08-20 21:01 ` Avery Pennarun
1 sibling, 1 reply; 13+ messages in thread
From: Andreas Färber @ 2008-08-20 20:40 UTC (permalink / raw)
To: ir0s; +Cc: git
Hello,
Am 20.08.2008 um 22:26 schrieb ir0s:
> $ git checkout mybranch
> Switched to branch "mybranch "
> Your branch is ahead of the tracked remote branch 'origin/
> remotebranch' by 4
> commits.
> mybranch
>
> Accurately, it has 4 commits that I haven't pushed yet. I try to
> push them
> but I get the following:
> $ git push origin remotebranch
> Everything up-to-date
>
> Any ideas?
You need to name the local branch, not the remote one:
$ git push origin mybranch
It should then push to remotebranch.
HTH,
Andreas
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 20:40 ` Andreas Färber
@ 2008-08-20 21:01 ` Avery Pennarun
2008-08-20 21:15 ` Junio C Hamano
0 siblings, 1 reply; 13+ messages in thread
From: Avery Pennarun @ 2008-08-20 21:01 UTC (permalink / raw)
To: Andreas Färber; +Cc: ir0s, git
On Wed, Aug 20, 2008 at 4:40 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> You need to name the local branch, not the remote one:
>
> $ git push origin mybranch
>
> It should then push to remotebranch.
Not only that, but the "ahead of tracked branch" message depends on
your local copy of the remote branch, not the remote copy of the
remote branch. So after pushing, you have to do:
git fetch origin
I've often wondered if we can't just have push refetch the updated
remote ref automatically. It's extremely hard to explain to newbies
that after a push, the order of refs from newest to oldest is 'origin
master', 'master', and 'origin/master'.
Have fun,
Avery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 21:01 ` Avery Pennarun
@ 2008-08-20 21:15 ` Junio C Hamano
2008-08-20 21:22 ` Avery Pennarun
0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-08-20 21:15 UTC (permalink / raw)
To: Avery Pennarun; +Cc: Andreas Färber, ir0s, git, Daniel Barkalow
"Avery Pennarun" <apenwarr@gmail.com> writes:
> On Wed, Aug 20, 2008 at 4:40 PM, Andreas Färber <andreas.faerber@web.de> wrote:
>> You need to name the local branch, not the remote one:
>>
>> $ git push origin mybranch
>>
>> It should then push to remotebranch.
>
> Not only that, but the "ahead of tracked branch" message depends on
> your local copy of the remote branch, not the remote copy of the
> remote branch.
I think we have long been doing so. Daniel, correct me.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 21:15 ` Junio C Hamano
@ 2008-08-20 21:22 ` Avery Pennarun
2008-08-20 22:25 ` Daniel Barkalow
0 siblings, 1 reply; 13+ messages in thread
From: Avery Pennarun @ 2008-08-20 21:22 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Andreas Färber, ir0s, git, Daniel Barkalow
On Wed, Aug 20, 2008 at 5:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
> "Avery Pennarun" <apenwarr@gmail.com> writes:
>
>> On Wed, Aug 20, 2008 at 4:40 PM, Andreas Färber <andreas.faerber@web.de> wrote:
>>> You need to name the local branch, not the remote one:
>>>
>>> $ git push origin mybranch
>>>
>>> It should then push to remotebranch.
>>
>> Not only that, but the "ahead of tracked branch" message depends on
>> your local copy of the remote branch, not the remote copy of the
>> remote branch.
>
> I think we have long been doing so. Daniel, correct me.
...and I'm dumb.
I apologize. "git pull origin mybranch" does not update
origin/mybranch. "git push origin mybranch" does.
It could be argued that pull should update the local reference too,
but that's irrelevant at the moment.
Have fun,
Avery
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 21:22 ` Avery Pennarun
@ 2008-08-20 22:25 ` Daniel Barkalow
2008-08-20 22:46 ` Junio C Hamano
0 siblings, 1 reply; 13+ messages in thread
From: Daniel Barkalow @ 2008-08-20 22:25 UTC (permalink / raw)
To: Avery Pennarun; +Cc: Junio C Hamano, Andreas Färber, ir0s, git
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1104 bytes --]
On Wed, 20 Aug 2008, Avery Pennarun wrote:
> On Wed, Aug 20, 2008 at 5:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
> > "Avery Pennarun" <apenwarr@gmail.com> writes:
> >
> >> On Wed, Aug 20, 2008 at 4:40 PM, Andreas Färber <andreas.faerber@web.de> wrote:
> >>> You need to name the local branch, not the remote one:
> >>>
> >>> $ git push origin mybranch
> >>>
> >>> It should then push to remotebranch.
> >>
> >> Not only that, but the "ahead of tracked branch" message depends on
> >> your local copy of the remote branch, not the remote copy of the
> >> remote branch.
> >
> > I think we have long been doing so. Daniel, correct me.
>
> ...and I'm dumb.
>
> I apologize. "git pull origin mybranch" does not update
> origin/mybranch. "git push origin mybranch" does.
>
> It could be argued that pull should update the local reference too,
> but that's irrelevant at the moment.
That is actually to say that fetch should do it (pull calls fetch for that
part), and I agree with that, assuming you've actually got that fetch
config, of course.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 22:25 ` Daniel Barkalow
@ 2008-08-20 22:46 ` Junio C Hamano
2008-08-21 15:35 ` ir0s
0 siblings, 1 reply; 13+ messages in thread
From: Junio C Hamano @ 2008-08-20 22:46 UTC (permalink / raw)
To: Daniel Barkalow; +Cc: Avery Pennarun, Andreas Färber, ir0s, git
Daniel Barkalow <barkalow@iabervon.org> writes:
> That is actually to say that fetch should do it (pull calls fetch for that
> part), and I agree with that, assuming you've actually got that fetch
> config, of course.
Hmm, traditionally, an explicit refspec on the command line that does not
store overrides the configured ones that do store, and I've been using it
as a feature when I run test fetches. If I do not like fetched result, I
can tell the other guy to fix his history and I do not have to contaminate
the history my tracking ref points at. IOW, I use my tracking refs not
just "this is where the guy is", but "this is the last good one I fetched
from that guy".
I could be persuaded to use reflog (e.g. "git diff his@{1}..his") and
manual tagging (i.e. "git tag -f last-good-his his") myself, but this is
"I'd _tolerate_ such a change myself", certainly not "I am happy with that
change and I'd help you guys advocate it and try convincing others who
shared my expectations to switch to reglog and manual tagging."
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-20 22:46 ` Junio C Hamano
@ 2008-08-21 15:35 ` ir0s
2008-08-21 16:22 ` Michael J Gruber
0 siblings, 1 reply; 13+ messages in thread
From: ir0s @ 2008-08-21 15:35 UTC (permalink / raw)
To: git
Sorry if you get this twice, oddly my first attempt to send this bounced.
Thank you for all the good advice however, none of it seemed to resolve my
issue.
Attempting to call:
$git push origin mybranch
Results in the same message: Everything up to date =/
I also tried to call $git fetch origin just in case, and doing a pull
doesn't return anything (which makes sense, no one pushed anything to the
branch -- although I seem to be the only one with this issue.)
Could my branch have somehow diverged from the origin remotebranch?
-- Irene
Junio C Hamano wrote:
>
> Daniel Barkalow <barkalow@iabervon.org> writes:
>
>> That is actually to say that fetch should do it (pull calls fetch for
>> that
>> part), and I agree with that, assuming you've actually got that fetch
>> config, of course.
>
> Hmm, traditionally, an explicit refspec on the command line that does not
> store overrides the configured ones that do store, and I've been using it
> as a feature when I run test fetches. If I do not like fetched result, I
> can tell the other guy to fix his history and I do not have to contaminate
> the history my tracking ref points at. IOW, I use my tracking refs not
> just "this is where the guy is", but "this is the last good one I fetched
> from that guy".
>
> I could be persuaded to use reflog (e.g. "git diff his@{1}..his") and
> manual tagging (i.e. "git tag -f last-good-his his") myself, but this is
> "I'd _tolerate_ such a change myself", certainly not "I am happy with that
> change and I'd help you guys advocate it and try convincing others who
> shared my expectations to switch to reglog and manual tagging."
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
View this message in context: http://n2.nabble.com/Local-branch-ahead-of-tracked-remote-branch-but-git-push-claims-everything-up-to-date-tp736663p740444.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-21 15:35 ` ir0s
@ 2008-08-21 16:22 ` Michael J Gruber
2008-08-21 16:53 ` ir0s
2008-08-21 16:55 ` ir0s
0 siblings, 2 replies; 13+ messages in thread
From: Michael J Gruber @ 2008-08-21 16:22 UTC (permalink / raw)
To: git
ir0s venit, vidit, dixit 21.08.2008 17:35:
> Sorry if you get this twice, oddly my first attempt to send this bounced.
> Thank you for all the good advice however, none of it seemed to resolve my
> issue.
>
> Attempting to call:
> $git push origin mybranch
>
> Results in the same message: Everything up to date =/
> I also tried to call $git fetch origin just in case, and doing a pull
> doesn't return anything (which makes sense, no one pushed anything to the
> branch -- although I seem to be the only one with this issue.)
>
> Could my branch have somehow diverged from the origin remotebranch?
>
> -- Irene
What do the following report:
git ls-remote origin
git ls-remote .
git log --pretty=oneline mybranch...origin/remotebranch
Michael
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-21 16:22 ` Michael J Gruber
@ 2008-08-21 16:53 ` ir0s
2008-08-22 14:09 ` Michael J Gruber
2008-08-21 16:55 ` ir0s
1 sibling, 1 reply; 13+ messages in thread
From: ir0s @ 2008-08-21 16:53 UTC (permalink / raw)
To: git
Hi Michael,
Here are my results:
$ git ls-remote origin
138ea08f9680a8def085b793c9cee70eed0e1f3b HEAD
138ea08f9680a8def085b793c9cee70eed0e1f3b refs/heads/master
75290a081feebcc4265825d017d9af07c7646951 refs/heads/remotebranch
f11c723119cd9938e91e1ed5328ef143fb477f15 refs/heads/mybranch
f11c723119cd9938e91e1ed5328ef143fb477f15 refs/heads/groups
...
There are a few more
Is it the case that mybranch somehow became a remote branch?
Here are the results for this one:
$ git log --pretty=oneline mybranch...origin/remotebranch
f11c723119cd9938e91e1ed5328ef143fb477f15 Merge branch 'remotebranch' of
gitosis@sorry.must.obfuscate.url.com:my-repo into mybranch
eb41bd8f4f43d483b4a58bc98386c468bb69173c Ticket #1032
5e76a7c9bce92519b308c031357794904bf0f4a6 Ticket #1038
cu5ceaf670c83f77c1b48e8d31a23456b744f1af0f Ticket #1044
Thank you!
-Irene
Michael J Gruber wrote:
>
> ir0s venit, vidit, dixit 21.08.2008 17:35:
>> Sorry if you get this twice, oddly my first attempt to send this bounced.
>> Thank you for all the good advice however, none of it seemed to resolve
>> my
>> issue.
>>
>> Attempting to call:
>> $git push origin mybranch
>>
>> Results in the same message: Everything up to date =/
>> I also tried to call $git fetch origin just in case, and doing a pull
>> doesn't return anything (which makes sense, no one pushed anything to the
>> branch -- although I seem to be the only one with this issue.)
>>
>> Could my branch have somehow diverged from the origin remotebranch?
>>
>> -- Irene
>
> What do the following report:
>
> git ls-remote origin
> git ls-remote .
> git log --pretty=oneline mybranch...origin/remotebranch
>
> Michael
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
View this message in context: http://n2.nabble.com/Local-branch-ahead-of-tracked-remote-branch-but-git-push-claims-everything-up-to-date-tp736663p740662.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-21 16:22 ` Michael J Gruber
2008-08-21 16:53 ` ir0s
@ 2008-08-21 16:55 ` ir0s
1 sibling, 0 replies; 13+ messages in thread
From: ir0s @ 2008-08-21 16:55 UTC (permalink / raw)
To: git
Sorry, and one more:
$ git ls-remote .
f11c723119cd9938e91e1ed5328ef143fb477f15 HEAD
138ea08f9680a8def085b793c9cee70eed0e1f3b refs/heads/master
75290a081feebcc4265825d017d9af07c7646951 refs/heads/remotebranch
f11c723119cd9938e91e1ed5328ef143fb477f15 refs/heads/mybranch
138ea08f9680a8def085b793c9cee70eed0e1f3b refs/remotes/origin/HEAD
138ea08f9680a8def085b793c9cee70eed0e1f3b refs/remotes/origin/master
75290a081feebcc4265825d017d9af07c7646951
refs/remotes/origin/remotebranch
f11c723119cd9938e91e1ed5328ef143fb477f15
refs/remotes/origin/mybranch
Thank you!!
-Irene
Michael J Gruber wrote:
>
> ir0s venit, vidit, dixit 21.08.2008 17:35:
>> Sorry if you get this twice, oddly my first attempt to send this bounced.
>> Thank you for all the good advice however, none of it seemed to resolve
>> my
>> issue.
>>
>> Attempting to call:
>> $git push origin mybranch
>>
>> Results in the same message: Everything up to date =/
>> I also tried to call $git fetch origin just in case, and doing a pull
>> doesn't return anything (which makes sense, no one pushed anything to the
>> branch -- although I seem to be the only one with this issue.)
>>
>> Could my branch have somehow diverged from the origin remotebranch?
>>
>> -- Irene
>
> What do the following report:
>
> git ls-remote origin
> git ls-remote .
> git log --pretty=oneline mybranch...origin/remotebranch
>
> Michael
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
View this message in context: http://n2.nabble.com/Local-branch-ahead-of-tracked-remote-branch-but-git-push-claims-everything-up-to-date-tp736663p740670.html
Sent from the git mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: Local branch ahead of tracked remote branch but git push claims everything up-to-date
2008-08-21 16:53 ` ir0s
@ 2008-08-22 14:09 ` Michael J Gruber
0 siblings, 0 replies; 13+ messages in thread
From: Michael J Gruber @ 2008-08-22 14:09 UTC (permalink / raw)
To: git
ir0s venit, vidit, dixit 21.08.2008 18:53:
> Hi Michael,
>
> Here are my results:
>
> $ git ls-remote origin
> 138ea08f9680a8def085b793c9cee70eed0e1f3b HEAD
> 138ea08f9680a8def085b793c9cee70eed0e1f3b refs/heads/master
> 75290a081feebcc4265825d017d9af07c7646951 refs/heads/remotebranch
> f11c723119cd9938e91e1ed5328ef143fb477f15 refs/heads/mybranch
> f11c723119cd9938e91e1ed5328ef143fb477f15 refs/heads/groups
> ...
> There are a few more
>
> Is it the case that mybranch somehow became a remote branch?
It means that the repo "origin" has a branch called mybranch. From the
sha1 and the one in your other mail (git ls-remote .) we see that it is
identical with your local branch mybranch. It is most certainly the
result of a command
git push origin mybranch
which (in the absence of any relevant lines in .git/config) just
says that you push that branch into origin with the same name, creating
a branch there if there's none. You can get rid of it using "git push
origin :mybranch".
What you most probably wanted to do was
git push origin mybranch:remotebranch
which pushes your mybranch into the remotebranch of the origin repo.
(You can put this in the config for later pushes, git config
remote.origin.push mybranch:remotebranch).
On the other hand:
git push origin
only compares existing branches with matching names, which is why it
reported "up to date".
On yet another hand (I'm losing count):
When you switch to a tracking branch it is compared to its
corresponding remote, and your mybranch and origin/remotebranch clearly
differ:
> Here are the results for this one: $ git log --pretty=oneline
> mybranch...origin/remotebranch
> f11c723119cd9938e91e1ed5328ef143fb477f15 Merge branch 'remotebranch'
> of gitosis@sorry.must.obfuscate.url.com:my-repo into mybranch
> eb41bd8f4f43d483b4a58bc98386c468bb69173c Ticket #1032
> 5e76a7c9bce92519b308c031357794904bf0f4a6 Ticket #1038
> cu5ceaf670c83f77c1b48e8d31a23456b744f1af0f Ticket #1044
Now, this
> f11c723119cd9938e91e1ed5328ef143fb477f15 HEAD
> 138ea08f9680a8def085b793c9cee70eed0e1f3b refs/heads/master
> 75290a081feebcc4265825d017d9af07c7646951 refs/heads/remotebranch
> f11c723119cd9938e91e1ed5328ef143fb477f15 refs/heads/mybranch
> 138ea08f9680a8def085b793c9cee70eed0e1f3b refs/remotes/origin/HEAD
> 138ea08f9680a8def085b793c9cee70eed0e1f3b refs/remotes/origin/master
> 75290a081feebcc4265825d017d9af07c7646951
> refs/remotes/origin/remotebranch
> f11c723119cd9938e91e1ed5328ef143fb477f15
> refs/remotes/origin/mybranch
from your other e-mail shows quite a zoo of branches you have locally
now. Two of them should probably not be there:
refs/remotes/origin/mybranch is the result of fetching/pulling from
origin after creating mybranch there by mistake.
refs/heads/remotebranch is a local branch named remotebranch. I don't
know where it came from, but git revlog may tell you more.
As a word of comfort: I'm quite new to git and find things confusing
sometimes, myself. But in the end I always found out that thinhs are the
way they are for a good reason.
You're thinking of "two places" to exchange information for a branch,
which is natural and confused me first, too. But realise that for a sane
workflow you need three:
- remotebranch at the other repo origin,
- your remotes/origin/remotebranch which pulls from origin's repo, and -
your local tracking branch mybranch which pulls or rebases from
remotes/origin/remotebranch at the time of your chosing.
You push from mybranch into the remotebranch of the origin repo.
That last one is the one that pushed you off ;) Seriously, that last leg
of the workflow triangle is not setup automatically (because you may not
have push access).
Cheers,
Michael
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-08-22 14:10 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-20 20:26 Local branch ahead of tracked remote branch but git push claims everything up-to-date ir0s
2008-08-20 20:37 ` Alex Riesen
2008-08-20 20:40 ` Andreas Färber
2008-08-20 21:01 ` Avery Pennarun
2008-08-20 21:15 ` Junio C Hamano
2008-08-20 21:22 ` Avery Pennarun
2008-08-20 22:25 ` Daniel Barkalow
2008-08-20 22:46 ` Junio C Hamano
2008-08-21 15:35 ` ir0s
2008-08-21 16:22 ` Michael J Gruber
2008-08-21 16:53 ` ir0s
2008-08-22 14:09 ` Michael J Gruber
2008-08-21 16:55 ` ir0s
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).