{"thread":{"id":"30114","subject":"rebase -p loses amended changes","startedAt":"2012-03-30T21:31:24Z","lastAt":"2012-03-30T22:49:55Z","messageCount":2,"participants":["J Robert Ray","Thomas Rast"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188212","messageId":"CADb3U=4DNt7Jnzq4eW-K+W1_sEfMgL6MxqY6qmPaJZagiFdmmg@mail.gmail.com","threadId":"30114","inReplyTo":null,"subject":"rebase -p loses amended changes","fromName":"J Robert Ray","fromEmail":"jrobertray@gmail.com","sentAt":"2012-03-30T21:31:24Z","receivedAt":"2012-03-30T21:31:24Z","isPatch":false,"sender":{"key":"jrobertray@gmail.com","avatar":null},"body":"I've found that 'rebase -p' can discard changes from a merge commit\nwhen it recreates the merge.\n\nIf a merge is amended to add changes to a file unaffected by the\nmerge, these changes are lost after a rebase. Attached is a script to\ndemonstrate the problem.\n\nI've tested the script against git 1.7.9.5.\n\nI'll outline the steps starting from an empty repo.\n\n1. Create a file (a) with some contents, then create three branches\nfrom this point, \"mod-a,\" \"mod-b,\" and \"master-copy.\"\n\n2. In \"mod-a,\" modify a.\n\n3. In \"mod-b,\" create a different file (b).\n\n4. Merge (--no-ff) \"mod-a\" onto master.\n\n5. Amend the merge with a modification to a.\n\n6. Merge (--no-ff) \"mod-b\" onto \"master-copy.\"\n\n7. Rebase -p master onto \"master-copy.\"\n\nNotice the change to \"a\" from step #5 is now gone. \"a\" reverts to the\npre-amended version after step #4.\n\nI assume this isn't expected behavior and is a bug.\n"},{"id":"188220","messageId":"87ty15vh4c.fsf@thomas.inf.ethz.ch","threadId":"30114","inReplyTo":"CADb3U=4DNt7Jnzq4eW-K+W1_sEfMgL6MxqY6qmPaJZagiFdmmg@mail.gmail.com","subject":"Re: rebase -p loses amended changes","fromName":"Thomas Rast","fromEmail":"trast@student.ethz.ch","sentAt":"2012-03-30T22:49:55Z","receivedAt":"2012-03-30T22:49:55Z","isPatch":false,"sender":{"key":"tr@thomasrast.ch","avatar":"https://avatars.githubusercontent.com/u/153510?v=4"},"body":"J Robert Ray <jrobertray@gmail.com> writes:\n\n> If a merge is amended to add changes to a file unaffected by the\n> merge, these changes are lost after a rebase. Attached is a script to\n> demonstrate the problem.\n\n> 4. Merge (--no-ff) \"mod-a\" onto master.\n>\n> 5. Amend the merge with a modification to a.\n\n> 7. Rebase -p master onto \"master-copy.\"\n>\n> Notice the change to \"a\" from step #5 is now gone. \"a\" reverts to the\n> pre-amended version after step #4.\n\nThat's pretty much expected. rebase -p attempts to (conflicts will\nhappen again) replay the merge.  I don't think anybody's come up with a\nclear idea of how to apply the conflicted or evil parts of the merge\nmechanically.\n\n-- \nThomas Rast\ntrast@{inf,student}.ethz.ch\n"}]}