git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* rebase problem
@ 2012-03-17 12:57 Joakim Tjernlund
  2012-03-17 13:30 ` Vincent van Ravesteijn
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2012-03-17 12:57 UTC (permalink / raw)
  To: git


A co-worker this on our local u-boot repo:
  git checkout master
  git fetch denx/master
  git merge denx/master
<resolve conflicts>
  git commit
  ...
  git commit
Now u-boot is working again
then update to latest u-boot so:
  git fetch denx/master
  git rebase denx/master
Now it is a mess, that rebase seems to start from way back as a
staring reference, not from the last merge shown above.
I guess I forgotten how git works, what did go wrong?

  Jocke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase problem
  2012-03-17 12:57 rebase problem Joakim Tjernlund
@ 2012-03-17 13:30 ` Vincent van Ravesteijn
  2012-03-17 14:31   ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent van Ravesteijn @ 2012-03-17 13:30 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: git

Op 17-3-2012 13:57, Joakim Tjernlund schreef:
> A co-worker this on our local u-boot repo:
>    git checkout master
>    git fetch denx/master
>    git merge denx/master
> <resolve conflicts>
>    git commit
>    ...
>    git commit
> Now u-boot is working again
> then update to latest u-boot so:
>    git fetch denx/master
>    git rebase denx/master
> Now it is a mess, that rebase seems to start from way back as a
> staring reference, not from the last merge shown above.
> I guess I forgotten how git works, what did go wrong?
>
>    Jocke
>
> --
> 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

The situation is like this:

  master - C - o - o - D - o - o - o - A
                      /
  denx/master- - - - o - o - o - o - B

Now, you ask to rebase master (A) onto denx/master (B). If master would 
have started from D, it would indeed apply the commits D -- A on top of 
B. In your case, however, master already had a lot of commits that were 
not in denx/master: C -- D  (including the merge resolution). So it will 
also apply C -- D on top of  B.

Vincent

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase problem
  2012-03-17 13:30 ` Vincent van Ravesteijn
@ 2012-03-17 14:31   ` Joakim Tjernlund
  2012-03-17 16:11     ` Vincent van Ravesteijn
  0 siblings, 1 reply; 5+ messages in thread
From: Joakim Tjernlund @ 2012-03-17 14:31 UTC (permalink / raw)
  To: Vincent van Ravesteijn; +Cc: git

Vincent van Ravesteijn <vfr@lyx.org> wrote on 2012/03/17 14:30:42:
>
> Op 17-3-2012 13:57, Joakim Tjernlund schreef:
> > A co-worker this on our local u-boot repo:
> >    git checkout master
> >    git fetch denx/master
> >    git merge denx/master
> > <resolve conflicts>
> >    git commit
> >    ...
> >    git commit
> > Now u-boot is working again
> > then update to latest u-boot so:
> >    git fetch denx/master
> >    git rebase denx/master
> > Now it is a mess, that rebase seems to start from way back as a
> > staring reference, not from the last merge shown above.
> > I guess I forgotten how git works, what did go wrong?
> >
> >    Jocke
> >
> > --
> > 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
>
> The situation is like this:
>
>   master - C - o - o - D - o - o - o - A
>                       /
>   denx/master- - - - o - o - o - o - B
>
> Now, you ask to rebase master (A) onto denx/master (B). If master would
> have started from D, it would indeed apply the commits D -- A on top of
> B. In your case, however, master already had a lot of commits that were
> not in denx/master: C -- D  (including the merge resolution). So it will
> also apply C -- D on top of  B.

Thanks, this makes sense. How do I get from above to

   master - C - o - o - D - o - o - o - A
                       /
   denx/master- - o - B


Jocke

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase problem
  2012-03-17 14:31   ` Joakim Tjernlund
@ 2012-03-17 16:11     ` Vincent van Ravesteijn
  2012-03-17 16:55       ` Joakim Tjernlund
  0 siblings, 1 reply; 5+ messages in thread
From: Vincent van Ravesteijn @ 2012-03-17 16:11 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: git

Op 17-3-2012 15:31, Joakim Tjernlund schreef:
> Vincent van Ravesteijn<vfr@lyx.org>  wrote on 2012/03/17 14:30:42:
>> Op 17-3-2012 13:57, Joakim Tjernlund schreef:
>>> A co-worker this on our local u-boot repo:
>>>     git checkout master
>>>     git fetch denx/master
>>>     git merge denx/master
>>> <resolve conflicts>
>>>     git commit
>>>     ...
>>>     git commit
>>> Now u-boot is working again
>>> then update to latest u-boot so:
>>>     git fetch denx/master
>>>     git rebase denx/master
>>> Now it is a mess, that rebase seems to start from way back as a
>>> staring reference, not from the last merge shown above.
>>> I guess I forgotten how git works, what did go wrong?
>>>
>>>     Jocke
>>>
>>> --
>>> 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
>> The situation is like this:
>>
>>    master - C - o - o - D - o - o - o - A
>>                        /
>>    denx/master- - - - o - o - o - o - B
>>
>> Now, you ask to rebase master (A) onto denx/master (B). If master would
>> have started from D, it would indeed apply the commits D -- A on top of
>> B. In your case, however, master already had a lot of commits that were
>> not in denx/master: C -- D  (including the merge resolution). So it will
>> also apply C -- D on top of  B.
> Thanks, this makes sense. How do I get from above to
>
>     master - C - o - o - D - o - o - o - A
>                         /
>     denx/master- - o - B
>
>
> Jocke
>
Don't you just want to merge with denx/master again ?

    master - C - o - o - D - o - o - o - A
                        /               /
    denx/master- - o - o - o - o - o - B


In this way you pull in the new commits from denx/master.

Of course you can rework your history such to obtain what you drew 
above, but this means you need to rewrite some of the history, which you 
probably don't want to do if you share this code with colleagues. But 
well, if you really want:

git checkout D~1
git merge B
git rebase --onto HEAD D master

Vincent

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rebase problem
  2012-03-17 16:11     ` Vincent van Ravesteijn
@ 2012-03-17 16:55       ` Joakim Tjernlund
  0 siblings, 0 replies; 5+ messages in thread
From: Joakim Tjernlund @ 2012-03-17 16:55 UTC (permalink / raw)
  To: Vincent van Ravesteijn; +Cc: git

Vincent van Ravesteijn <vfr@lyx.org> wrote on 2012/03/17 17:11:21:
>
> Op 17-3-2012 15:31, Joakim Tjernlund schreef:
> > Vincent van Ravesteijn<vfr@lyx.org>  wrote on 2012/03/17 14:30:42:
> >> Op 17-3-2012 13:57, Joakim Tjernlund schreef:
> >>> A co-worker this on our local u-boot repo:
> >>>     git checkout master
> >>>     git fetch denx/master
> >>>     git merge denx/master
> >>> <resolve conflicts>
> >>>     git commit
> >>>     ...
> >>>     git commit
> >>> Now u-boot is working again
> >>> then update to latest u-boot so:
> >>>     git fetch denx/master
> >>>     git rebase denx/master
> >>> Now it is a mess, that rebase seems to start from way back as a
> >>> staring reference, not from the last merge shown above.
> >>> I guess I forgotten how git works, what did go wrong?
> >>>
> >>>     Jocke
> >>>
> >>> --
> >>> 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
> >> The situation is like this:
> >>
> >>    master - C - o - o - D - o - o - o - A
> >>                        /
> >>    denx/master- - - - o - o - o - o - B
> >>
> >> Now, you ask to rebase master (A) onto denx/master (B). If master would
> >> have started from D, it would indeed apply the commits D -- A on top of
> >> B. In your case, however, master already had a lot of commits that were
> >> not in denx/master: C -- D  (including the merge resolution). So it will
> >> also apply C -- D on top of  B.
> > Thanks, this makes sense. How do I get from above to
> >
> >     master - C - o - o - D - o - o - o - A
> >                         /
> >     denx/master- - o - B
> >
> >
> > Jocke
> >
> Don't you just want to merge with denx/master again ?
>
>     master - C - o - o - D - o - o - o - A
>                         /               /
>     denx/master- - o - o - o - o - o - B
>
>
> In this way you pull in the new commits from denx/master.
>
> Of course you can rework your history such to obtain what you drew
> above, but this means you need to rewrite some of the history, which you
> probably don't want to do if you share this code with colleagues. But
> well, if you really want:
>
> git checkout D~1
> git merge B
> git rebase --onto HEAD D master

Thanks, the code has not been pushed yet and we don't want more merges than
necessary so I will try your suggestion on Monday when I meet meet my co-worker
again.

 Once again, thanks
                      Jocke

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-17 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-17 12:57 rebase problem Joakim Tjernlund
2012-03-17 13:30 ` Vincent van Ravesteijn
2012-03-17 14:31   ` Joakim Tjernlund
2012-03-17 16:11     ` Vincent van Ravesteijn
2012-03-17 16:55       ` Joakim Tjernlund

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).