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

rebase -p loses amended changes

From
JRJ Robert Ray <jrobertray@gmail.com>
Date
Mar 30, 2012, 21:31 UTC
Message-ID
<CADb3U=4DNt7Jnzq4eW-K+W1_sEfMgL6MxqY6qmPaJZagiFdmmg@mail.gmail.com>

I've found that 'rebase -p' can discard changes from a merge commit when it recreates the merge.

If a merge is amended to add changes to a file unaffected by the merge, these changes are lost after a rebase. Attached is a script to demonstrate the problem.

I've tested the script against git 1.7.9.5.
I'll outline the steps starting from an empty repo.
1. Create a file (a) with some contents, then create three branches
from this point, "mod-a," "mod-b," and "master-copy."
2. In "mod-a," modify a.
3. In "mod-b," create a different file (b).
4. Merge (--no-ff) "mod-a" onto master.
5. Amend the merge with a modification to a.
6. Merge (--no-ff) "mod-b" onto "master-copy."
7. Rebase -p master onto "master-copy."

Notice the change to "a" from step #5 is now gone. "a" reverts to the pre-amended version after step #4.

I assume this isn't expected behavior and is a bug.
Next: Thomas Rast
Message 1 of 2 in “rebase -p loses amended changes”
  1. J Robert RayMar 30, 2012
  2. Thomas RastMar 30, 2012

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.