* Help understanding "rebase"
@ 2009-03-10 21:07 John M. Dlugosz
2009-03-10 21:30 ` Brandon Casey
0 siblings, 1 reply; 4+ messages in thread
From: John M. Dlugosz @ 2009-03-10 21:07 UTC (permalink / raw)
To: git
Here is the situation: An old topic branch containing 3 commits. A dev branch that has
recently been merged. To catch up the topic's work before adding it to dev, I expected
that rebase would do what I ended up doing manually, detailed below.
Instead, it crunched away for a long time and gave errors applying patches.
So I did it manually by checking out dev, then cherry-picking each of the three commits.
Actually, this left it on top of dev, but suppose I had created a new branch at dev,
cherry-picked the stuff from the old topic branch, and then deleted the old topic branch.
Now I have a new topic branch with the rebased changes, albeit with a different branch
name. Point is, there were no conflicts and the changes were simple, so cherry-picking
each node was clean.
So, what did the rebase command try to do? I think it may have something to do with
finding a common root between the topic and dev, which, due to the merge, was a long way
back. Something like this:
o--o-- ... --o
/ \
A--...--B-- ... --C--D <== dev
\
q--r--s <== topic
I was able to cherry-pick q,r,s on top of D without any issues. So why did rebase get in
such a tizzy?
--John
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help understanding "rebase"
2009-03-10 21:07 Help understanding "rebase" John M. Dlugosz
@ 2009-03-10 21:30 ` Brandon Casey
2009-03-11 9:24 ` Michael J Gruber
0 siblings, 1 reply; 4+ messages in thread
From: Brandon Casey @ 2009-03-10 21:30 UTC (permalink / raw)
To: John M. Dlugosz; +Cc: git
John M. Dlugosz wrote:
> Here is the situation: An old topic branch containing 3 commits. A dev
> branch that has recently been merged. To catch up the topic's work
> before adding it to dev, I expected that rebase would do what I ended up
> doing manually, detailed below.
>
> Instead, it crunched away for a long time and gave errors applying patches.
>
> So I did it manually by checking out dev, then cherry-picking each of
> the three commits. Actually, this left it on top of dev, but suppose I
> had created a new branch at dev, cherry-picked the stuff from the old
> topic branch, and then deleted the old topic branch. Now I have a new
> topic branch with the rebased changes, albeit with a different branch
> name. Point is, there were no conflicts and the changes were simple, so
> cherry-picking each node was clean.
>
> So, what did the rebase command try to do? I think it may have
> something to do with finding a common root between the topic and dev,
> which, due to the merge, was a long way back. Something like this:
>
> o--o-- ... --o
> / \
> A--...--B-- ... --C--D <== dev
> \
> q--r--s <== topic
>
>
> I was able to cherry-pick q,r,s on top of D without any issues. So why
> did rebase get in such a tizzy?
It may help those who know the internals of git-rebase if you supplied the
commands you used and your git version.
So, you're saying you did
git checkout topic
git rebase dev
or the equivalent
git rebase dev topic
? Are you sure you didn't get the arguments to rebase reversed?
-brandon
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help understanding "rebase"
2009-03-10 21:30 ` Brandon Casey
@ 2009-03-11 9:24 ` Michael J Gruber
0 siblings, 0 replies; 4+ messages in thread
From: Michael J Gruber @ 2009-03-11 9:24 UTC (permalink / raw)
To: Brandon Casey; +Cc: John M. Dlugosz, git
Brandon Casey venit, vidit, dixit 10.03.2009 22:30:
> John M. Dlugosz wrote:
>> Here is the situation: An old topic branch containing 3 commits. A dev
>> branch that has recently been merged. To catch up the topic's work
>> before adding it to dev, I expected that rebase would do what I ended up
>> doing manually, detailed below.
>>
>> Instead, it crunched away for a long time and gave errors applying patches.
>>
>> So I did it manually by checking out dev, then cherry-picking each of
>> the three commits. Actually, this left it on top of dev, but suppose I
>> had created a new branch at dev, cherry-picked the stuff from the old
>> topic branch, and then deleted the old topic branch. Now I have a new
>> topic branch with the rebased changes, albeit with a different branch
>> name. Point is, there were no conflicts and the changes were simple, so
>> cherry-picking each node was clean.
>>
>> So, what did the rebase command try to do? I think it may have
>> something to do with finding a common root between the topic and dev,
>> which, due to the merge, was a long way back. Something like this:
>>
>> o--o-- ... --o
>> / \
>> A--...--B-- ... --C--D <== dev
>> \
>> q--r--s <== topic
>>
>>
>> I was able to cherry-pick q,r,s on top of D without any issues. So why
>> did rebase get in such a tizzy?
> It may help those who know the internals of git-rebase if you supplied the
> commands you used and your git version.
>
> So, you're saying you did
>
> git checkout topic
> git rebase dev
>
> or the equivalent
>
> git rebase dev topic
>
> ? Are you sure you didn't get the arguments to rebase reversed?
>
> -brandon
>
That happens very easily: You want to rewrite dev using rebase, so you
check out dev. You want to rebase the topic branch, so you run "git
rebase topic". Very logical, but the wrong way round... The doc is
clear, though.
A useful mnemonic is that git rebase A B is about the commits A..B (B
defaulting to the current branch), and that the new B after rebasing will be
B' = C + (A..B)
where C is the value of --onto, which defaults to A. The point of rebase
is that A + (A..B) does not equal B in general, even though A..B=^A B ;)
git rebase A does not rewrite/rebase A! I'll think about a concise first
paragraph for git-rebase.txt.
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Help understanding "rebase"
@ 2009-03-11 20:04 John Dlugosz
0 siblings, 0 replies; 4+ messages in thread
From: John Dlugosz @ 2009-03-11 20:04 UTC (permalink / raw)
To: git, casey
=== Re: ===
It may help those who know the internals of git-rebase if you supplied
the
commands you used and your git version.
So, you're saying you did
git checkout topic
git rebase dev
or the equivalent
git rebase dev topic
? Are you sure you didn't get the arguments to rebase reversed?
===end===
Sorry, I did not write down exactly what I typed. But the situation was
the latter:
git rebase dev topic
While looking at the man page to get the arguments right, with dev being
"upstream" and the branch to rewrite last. I suppose I _could_ have
gotten it backwards.
--John
(please excuse the footer)
TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
If you received this in error, please contact the sender and delete the material from any computer.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-11 20:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-10 21:07 Help understanding "rebase" John M. Dlugosz
2009-03-10 21:30 ` Brandon Casey
2009-03-11 9:24 ` Michael J Gruber
-- strict thread matches above, loose matches on Subject: below --
2009-03-11 20:04 John Dlugosz
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).