* Preserve merge changes with rebase -p
@ 2011-06-21 12:11 Matteo Cypriani
2011-06-21 14:44 ` Andrew Wong
0 siblings, 1 reply; 3+ messages in thread
From: Matteo Cypriani @ 2011-06-21 12:11 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: Text/Plain, Size: 1095 bytes --]
Hi all,
I needed to change the author of a commit that was before a merge in the
history. Here is a figure of my situation, E being the commit I want to edit,
and M the problematic merge commit:
o---o---o---o---o---o---o---o master
\ \
o---E---M---o---o topic
In a simple case, git rebase -i -p from topic does the trick here, I can amend
E and M is re-created correctly.
The thing is, my M was not a "simple merge commit", but contained some changes
needed for the code in master and topic to work together. In that case, git
rebase -i -p recreates a merge commit, but it does not keep the changes
introduced in M.
Is there any way to keep the M's changes in my case (except to manually patch
& amend the re-created merge commit) ?
If not, maybe it would be a nice functionnality to implement ?
Cheers,
Matteo
P.S.: Please CC me if you answer to this e-mail, as I'm not subscribed to the
list.
--
Ma clef GPG est disponible sur keyserver.veridis.com
My GPG key is available on keyserver.veridis.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Preserve merge changes with rebase -p
2011-06-21 12:11 Preserve merge changes with rebase -p Matteo Cypriani
@ 2011-06-21 14:44 ` Andrew Wong
2011-06-21 15:07 ` Matteo Cypriani
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Wong @ 2011-06-21 14:44 UTC (permalink / raw)
To: Matteo Cypriani; +Cc: git
On 06/21/2011 08:11 AM, Matteo Cypriani wrote:
> The thing is, my M was not a "simple merge commit", but contained some changes
> needed for the code in master and topic to work together. In that case, git
> rebase -i -p recreates a merge commit, but it does not keep the changes
> introduced in M.
>
> Is there any way to keep the M's changes in my case (except to manually patch
> & amend the re-created merge commit) ?
>
Unfortunately, I don't think there's any nice way to do it right now. I
think what you could do for now is make the "pick <M>" into a "edit
<M>", together with other changes you want to make. And then when you
get to "edit M", do a "git cherry-pick -n -m 1 <M>", or "-m 2" depending
on how your merge was done. That should bring your changes over. Then
you just need resolve and add any conflicts, and do a "rebase --continue".
I've only tried it on a simple case and that seems to work.
> If not, maybe it would be a nice functionnality to implement ?
>
I imagine this is pretty useful feature to have too. I could look into
adding this support when I got a chance. I haven't given it much thought
yet though, so I don't know how feasible it is.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Preserve merge changes with rebase -p
2011-06-21 14:44 ` Andrew Wong
@ 2011-06-21 15:07 ` Matteo Cypriani
0 siblings, 0 replies; 3+ messages in thread
From: Matteo Cypriani @ 2011-06-21 15:07 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: Text/Plain, Size: 849 bytes --]
Le mardi 21 juin 2011 16:44:48, Andrew Wong a écrit :
> Unfortunately, I don't think there's any nice way to do it right now. I
> think what you could do for now is make the "pick <M>" into a "edit
> <M>", together with other changes you want to make. And then when you
> get to "edit M", do a "git cherry-pick -n -m 1 <M>", or "-m 2" depending
> on how your merge was done. That should bring your changes over. Then
> you just need resolve and add any conflicts, and do a "rebase --continue".
Thank you, I'll try that the next time.
> I imagine this is pretty useful feature to have too. I could look into
> adding this support when I got a chance.
That would be great, many thanks in advance!
Cheers,
Matteo
--
Ma clef GPG est disponible sur keyserver.veridis.com
My GPG key is available on keyserver.veridis.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-06-21 15:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21 12:11 Preserve merge changes with rebase -p Matteo Cypriani
2011-06-21 14:44 ` Andrew Wong
2011-06-21 15:07 ` Matteo Cypriani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox