rebase -p loses amended changes

From: J Robert Ray <hidden>
Date: 2016-06-15 22:53:26

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.

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help