* flatten-merge history
@ 2014-10-25 12:31 Henning Moll
2014-10-26 5:46 ` Christian Couder
0 siblings, 1 reply; 7+ messages in thread
From: Henning Moll @ 2014-10-25 12:31 UTC (permalink / raw)
To: git
Hi,
suppose the following history
P - - - Q - - - - - R <-extern
A -- - B - - - C - D - - - E <-master
\ \
M ... \ <-b1
\
W ... <-b2
Note that master and extern do not have a common parent. Both histories
are 'distinct', they do not share common files, so there can't be any
merge conflicts. What i want to achieve is this history:
P - - - Q - - - - - R <-extern
A -P'- B'- Q'- C'- D'- R'- E' <-master
\ \
M'... \ <-b1
\
W'... <-b2
The two histories should be merged in chronological order.
So while master reflects P-Q-R, b2 should only reflect P-Q and b1 should
only reflect P.
All my current attempts (surgery with git replace or interactive rebase
combined with merging) were not successfull.
Any ideas?
Best regards
Henning
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flatten-merge history
2014-10-25 12:31 flatten-merge history Henning Moll
@ 2014-10-26 5:46 ` Christian Couder
2014-10-26 14:36 ` Henning Moll
0 siblings, 1 reply; 7+ messages in thread
From: Christian Couder @ 2014-10-26 5:46 UTC (permalink / raw)
To: Henning Moll; +Cc: git
Hi,
On Sat, Oct 25, 2014 at 2:31 PM, Henning Moll <newsScott@gmx.de> wrote:
> Hi,
>
> suppose the following history
>
> P - - - Q - - - - - R <-extern
>
> A -- - B - - - C - D - - - E <-master
> \ \
> M ... \ <-b1
> \
> W ... <-b2
>
>
> Note that master and extern do not have a common parent. Both histories are
> 'distinct', they do not share common files, so there can't be any merge
> conflicts. What i want to achieve is this history:
>
> P - - - Q - - - - - R <-extern
>
> A -P'- B'- Q'- C'- D'- R'- E' <-master
> \ \
> M'... \ <-b1
> \
> W'... <-b2
>
> The two histories should be merged in chronological order.
> So while master reflects P-Q-R, b2 should only reflect P-Q and b1 should
> only reflect P.
>
> All my current attempts (surgery with git replace or interactive rebase
> combined with merging) were not successfull.
Could you tell us why interactive rebase did not work?
If there can't be any merge conflict between both histories, it should
have worked without asking you to resolve any conflict.
Best,
Christian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flatten-merge history
2014-10-26 5:46 ` Christian Couder
@ 2014-10-26 14:36 ` Henning Moll
2014-10-26 15:19 ` Andreas Schwab
0 siblings, 1 reply; 7+ messages in thread
From: Henning Moll @ 2014-10-26 14:36 UTC (permalink / raw)
To: git; +Cc: Christian Couder
Am 26.10.2014 um 06:46 schrieb Christian Couder:
> Hi,Could you tell us why interactive rebase did not work?
First of all i have to admit that i did not i-rebase-merge, but
i-rebase-cherrypick. Now i tried it with i-rebase-merge and it didn't
work either.
Here's my workflow, which i repeated for all commits of 'extern' (in
chronological order'). For simplicity let's assume that there is a
parent commit for 'A'
1. For P, A is the nearest prior commit on 'master'
2. on master: git rebase -i A^
3. change A from pick to edit. save. quit
4. git merge P
5. git rebase --continue
From the perspective of 'master' this worked. But as all of the commits
have been rewritten, the branches b1 and b2 no longer refer to 'master'.
Branch b2, for example, still branches off at B and not B'. So after
this action, my history looks like this:
P - - - Q - - - - - R <-extern
\
A'- m - B'- - - C'- D'- - - E' <-master
A - - - B - - - C - D
\ \
M ... \ <-b1
\
W ... <-b2
A and A' are nearly the same: they only differ in the new
GIT_COMITTER_DATE.
Now this is what i try to get (after only applying P):
P - - - Q - - - - - R <-extern
\
A'- m - B'- - - C'- D'- - - E' <-master
\ \
M'... \ <-b1
\
W'... <-b2
Regards
Henning
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flatten-merge history
2014-10-26 14:36 ` Henning Moll
@ 2014-10-26 15:19 ` Andreas Schwab
2014-10-26 19:02 ` Christian Couder
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Schwab @ 2014-10-26 15:19 UTC (permalink / raw)
To: Henning Moll; +Cc: git, Christian Couder
Henning Moll <newsScott@gmx.de> writes:
> 1. For P, A is the nearest prior commit on 'master'
> 2. on master: git rebase -i A^
> 3. change A from pick to edit. save. quit
> 4. git merge P
> 5. git rebase --continue
>
> From the perspective of 'master' this worked. But as all of the commits
> have been rewritten, the branches b1 and b2 no longer refer to
> 'master'. Branch b2, for example, still branches off at B and not B'.
You only rebased master, so b1 and b2 were unchanged. If you want to
change b1 and b2 you have to rebase them as well.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flatten-merge history
2014-10-26 15:19 ` Andreas Schwab
@ 2014-10-26 19:02 ` Christian Couder
2014-10-26 23:45 ` Henning Moll
0 siblings, 1 reply; 7+ messages in thread
From: Christian Couder @ 2014-10-26 19:02 UTC (permalink / raw)
To: Henning Moll; +Cc: git, Andreas Schwab
On Sun, Oct 26, 2014 at 4:19 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Henning Moll <newsScott@gmx.de> writes:
>
>> 1. For P, A is the nearest prior commit on 'master'
>> 2. on master: git rebase -i A^
>> 3. change A from pick to edit. save. quit
>> 4. git merge P
>> 5. git rebase --continue
>>
>> From the perspective of 'master' this worked. But as all of the commits
>> have been rewritten, the branches b1 and b2 no longer refer to
>> 'master'. Branch b2, for example, still branches off at B and not B'.
>
> You only rebased master, so b1 and b2 were unchanged. If you want to
> change b1 and b2 you have to rebase them as well.
Yeah. Henning, when interactively rebasing, in our editor, you should
have something like:
pick A
pick P
pick B
pick Q
pick C
pick D
pick R
pick E
which should work without any conflict.
And then you can rebase the b1 and b2 branches on the resulting branch.
Best,
Christian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flatten-merge history
2014-10-26 19:02 ` Christian Couder
@ 2014-10-26 23:45 ` Henning Moll
2014-10-27 18:45 ` Andreas Schwab
0 siblings, 1 reply; 7+ messages in thread
From: Henning Moll @ 2014-10-26 23:45 UTC (permalink / raw)
To: git; +Cc: Christian Couder
Am 26.10.2014 um 20:02 schrieb Christian Couder:
> Yeah. Henning, when interactively rebasing, in our editor, you should
> have something like: pick A pick P pick B pick Q pick C pick D pick R
> pick E which should work without any conflict. And then you can rebase
> the b1 and b2 branches on the resulting branch.
Thank you all very much. It worked!
I didn't know that i could also introduce new commits in the interactive
rebase list. Just for the record, in case others need to do such a task:
intial situation:
P - - - Q - - - - - R <-extern
A - - - B - - - C - D - - - E <-master
\ \
M ... \ <-b1
\
W ... <-b2
On master:
$ git rebase -i --root
(editor opens showing
pick A
pick B
pick C
pick D
pick E
modify this to
pick A
pick P
pick B
pick Q
pick C
pick D
pick R
pick E
save, quit. Now, master is already fixed. Now fix the branches:
$ git rebase --onto B' B b1
$ git rebase --onto D' D b2
Just a final question: Is it possible to keep the GIT_COMMITTER_DATE in
all those rebases?
Thanks again
Henning
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: flatten-merge history
2014-10-26 23:45 ` Henning Moll
@ 2014-10-27 18:45 ` Andreas Schwab
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2014-10-27 18:45 UTC (permalink / raw)
To: Henning Moll; +Cc: git, Christian Couder
Henning Moll <newsScott@gmx.de> writes:
> Just a final question: Is it possible to keep the GIT_COMMITTER_DATE in
> all those rebases?
If you want that you need to work with git filter-branch.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-10-27 18:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-25 12:31 flatten-merge history Henning Moll
2014-10-26 5:46 ` Christian Couder
2014-10-26 14:36 ` Henning Moll
2014-10-26 15:19 ` Andreas Schwab
2014-10-26 19:02 ` Christian Couder
2014-10-26 23:45 ` Henning Moll
2014-10-27 18:45 ` Andreas Schwab
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.