git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Preserve merge changes with rebase -p

From
MCMatteo Cypriani <mcy@lm7.fr>
Date
Jun 21, 2011, 12:11 UTC
Message-ID
<201106211411.31739.mcy@lm7.fr>
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
Next: Andrew Wong
Message 1 of 3 in “Preserve merge changes with rebase -p”
  1. Matteo CyprianiJun 21, 2011
  2. Andrew WongJun 21, 2011
  3. Matteo CyprianiJun 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.