From: Sergey Organov Date: Mon, 09 Feb 2015 12:53:54 GMT Subject: Re: 'git rebase' silently drops changes? Message-ID: <87oap38cv1.fsf@osv.gnss.ru> In-Reply-To: <54D7696B.3060407@kdbg.org> Johannes Sixt writes: > Am 07.02.2015 um 22:32 schrieb Sebastian Schuberth: >> On 06.02.2015 22:28, Sergey Organov wrote: >> >>> # Now rebase my work. >>> git rebase -f HEAD~1 >>> >>> # What? Where is my "Precious" change in "a"??? >>> cat a >>> >>> >>> I.e., the modification marked [!] was silently lost during rebase! >> >> Just a wild guess: Maybe because you omitted "-p" / "--preserve-merges" >> from "git rebase"? > > No, that would not help. --preserve-merges repeats the merge, but does > not apply the amendment. Really? Why? Here the valid concern you gave below doesn't even apply! Check... yes, git silently drops amend even with --preserve-merges (script to reproduce at the end[1])! How comes? > It's just how rebase works: It omits merge commits when it linearizes > history. > > Sergey, it is impossible for git rebase to decide to which rebased > commit the amendement applies. It doesn't even try to guess. It's the > responsibility of the user to apply the amendment to the correct > commit. Yeah, this sounds reasonable, /except/ git even gives no warning when it drops amendments. Shouldn't 'git rebase' rather consider merge amendment a kind of conflict? [1] To reproduce amend drop by "git rebase --preserve-merges": -- Sergey.