{"thread":{"id":"44119","subject":"Limitiations of git rebase --preserve-merges --interactive","startedAt":"2016-09-20T08:54:49Z","lastAt":"2016-09-23T22:26:14Z","messageCount":15,"participants":["Stefan Haller","Anatoly Borodin","Kevin Daudt","Stefan Beller","Junio C Hamano","Johannes Sixt","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"302219","messageId":"1mtveu4.19lvgi1c0hmhaM%lists@haller-berlin.de","threadId":"44119","inReplyTo":null,"subject":"Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2016-09-20T08:46:02Z","receivedAt":"2016-09-20T08:54:49Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"The BUGS section of the git-rebase manpage says that editing or\nrewording commits \"should work fine\", but attempts to reorder commits\nusually don't do what you want.\n\nI'd like to know more about what does or doesn't work. For example, will\nsquashing commits work? (I.e. using the \"fixup\" or \"squash\" commands in\nthe todo sheet.)\n\nWill dropping commits work?\n\nDoes it make sense to insert \"exec\" commands, or will they run at\narbitrary times?\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"302400","messageId":"ns1bln$2ej$1@blaine.gmane.org","threadId":"44119","inReplyTo":"1mtveu4.19lvgi1c0hmhaM%lists@haller-berlin.de","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Anatoly Borodin","fromEmail":"anatoly.borodin@gmail.com","sentAt":"2016-09-22T19:33:11Z","receivedAt":"2016-09-22T19:33:43Z","isPatch":false,"sender":{"key":"anatoly.borodin@gmail.com","avatar":"https://gravatar.com/avatar/59f11f1f45cf5ebb7bcca8da94b43cfe5f596d91c0a3e27ad0d2a861cc2bbce7?d=mp&s=160"},"body":"Hi Stefan,\n\nthis section was added to the manual in the commit\ncddb42d2c58a9de9b2b5ef68817778e7afaace3e by \"Jonathan Nieder\"\n<jrnieder@gmail.com> 6 years ago. Maybe he remembers better?\n\n-- \nMit freundlichen Grüßen,\nAnatoly Borodin\n\n"},{"id":"302401","messageId":"20160922194848.GB6641@ikke.info","threadId":"44119","inReplyTo":"ns1bln$2ej$1@blaine.gmane.org","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2016-09-22T19:48:48Z","receivedAt":"2016-09-22T19:49:08Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Thu, Sep 22, 2016 at 07:33:11PM +0000, Anatoly Borodin wrote:\n> Hi Stefan,\n> \n> this section was added to the manual in the commit\n> cddb42d2c58a9de9b2b5ef68817778e7afaace3e by \"Jonathan Nieder\"\n> <jrnieder@gmail.com> 6 years ago. Maybe he remembers better?\n> \n\nJust to make it clear, this section explicitly talks about 'bugs' with\npreserve-merges and interactive rebase.  Without the --preserve-merges\noption, those operations works as expected.\n\nThe reason, as that section explains, is that it's not possible to store\nthe merge structure in the flat todo list. I assume this means git\ninternally remembers where the merge commit was, and then restores it\nwhile rebasing.\n\nChanging the order, or dropping commits might then give unexpected\nresults.\n\n\n"},{"id":"302408","messageId":"CAGZ79kYoFH0dbQwvL_2JOtd8aybH8MKCtzy+p_88+QykVTGUtg@mail.gmail.com","threadId":"44119","inReplyTo":"20160922194848.GB6641@ikke.info","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-09-22T20:54:25Z","receivedAt":"2016-09-22T20:54:32Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Sep 22, 2016 at 12:48 PM, Kevin Daudt <me@ikke.info> wrote:\n> On Thu, Sep 22, 2016 at 07:33:11PM +0000, Anatoly Borodin wrote:\n>> Hi Stefan,\n>>\n>> this section was added to the manual in the commit\n>> cddb42d2c58a9de9b2b5ef68817778e7afaace3e by \"Jonathan Nieder\"\n>> <jrnieder@gmail.com> 6 years ago. Maybe he remembers better?\n>>\n>\n> Just to make it clear, this section explicitly talks about 'bugs' with\n> preserve-merges and interactive rebase.  Without the --preserve-merges\n> option, those operations works as expected.\n>\n> The reason, as that section explains, is that it's not possible to store\n> the merge structure in the flat todo list. I assume this means git\n> internally remembers where the merge commit was, and then restores it\n> while rebasing.\n>\n> Changing the order, or dropping commits might then give unexpected\n> results.\n>\n\nThe commit message may help as well:\n\n    rebase -i -p: document shortcomings\n\n    The rebase --preserve-merges facility presents a list of commits\n    in its instruction sheet and uses a separate table to keep\n    track of their parents.  Unfortunately, in practice this means\n    that with -p after most attempts to rearrange patches, some\n    commits have the \"wrong\" parent and the resulting history is\n    rarely what the caller expected.\n\n    Yes, it would be nice to fix that.  But first, add a warning to the\n    manual to help the uninitiated understand what is going on.\n"},{"id":"302411","messageId":"ns1gr4$pjs$1@blaine.gmane.org","threadId":"44119","inReplyTo":"1mtveu4.19lvgi1c0hmhaM%lists@haller-berlin.de","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Anatoly Borodin","fromEmail":"anatoly.borodin@gmail.com","sentAt":"2016-09-22T21:01:24Z","receivedAt":"2016-09-22T21:02:16Z","isPatch":false,"sender":{"key":"anatoly.borodin@gmail.com","avatar":"https://gravatar.com/avatar/59f11f1f45cf5ebb7bcca8da94b43cfe5f596d91c0a3e27ad0d2a861cc2bbce7?d=mp&s=160"},"body":"Hi Stefan,\n\nI've also done some archaeology and found that the original version of\nthe merge preserving code was written by Johannes Schindelin\n<Johannes.Schindelin@gmx.de>, see e.g.\nf09c9b8c5ff9d8a15499b09ccd6c3e7b3c76af77\n\nThere were also some big discussion threads in 2007-2008 regarding a\nbetter mechanism to \"mark\" or \"tag\" the heads of rebased branches, but I\nhaven't seen consensus and development in that direction after that.\n\nPS There are also some pieces of \"what should work\" in these tests:\n\nt/t3409-rebase-preserve-merges.sh*\nt/t3410-rebase-preserve-dropped-merges.sh*\nt/t3411-rebase-preserve-around-merges.sh*\nt/t3414-rebase-preserve-onto.sh*\n\n\n-- \nMit freundlichen Grüßen,\nAnatoly Borodin\n\n"},{"id":"302412","messageId":"ns1h09$pjs$2@blaine.gmane.org","threadId":"44119","inReplyTo":"20160922194848.GB6641@ikke.info","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Anatoly Borodin","fromEmail":"anatoly.borodin@gmail.com","sentAt":"2016-09-22T21:04:09Z","receivedAt":"2016-09-22T21:05:19Z","isPatch":false,"sender":{"key":"anatoly.borodin@gmail.com","avatar":"https://gravatar.com/avatar/59f11f1f45cf5ebb7bcca8da94b43cfe5f596d91c0a3e27ad0d2a861cc2bbce7?d=mp&s=160"},"body":"Hi Kevin,\n\nKevin Daudt <me@ikke.info> wrote:\n> Changing the order, or dropping commits might then give unexpected\n> results.\n\nThe question that Stefan has is rather \"what is *supposed* to work /\ngive *expected* results?\". Some stuff can be found in the tests\n(t/t*rebase*preserve*), but maybe there is more?\n\n-- \nMit freundlichen Grüßen,\nAnatoly Borodin\n\n"},{"id":"302413","messageId":"CAGZ79kadpe5wG0gSpk-oasxCGuUp+3bSv-A4vhyFC+y0oL-+ww@mail.gmail.com","threadId":"44119","inReplyTo":"ns1gr4$pjs$1@blaine.gmane.org","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-09-22T21:08:07Z","receivedAt":"2016-09-22T21:08:22Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Thu, Sep 22, 2016 at 2:01 PM, Anatoly Borodin\n<anatoly.borodin@gmail.com> wrote:\n> Hi Stefan,\n>\n> I've also done some archaeology and found that the original version of\n> the merge preserving code was written by Johannes Schindelin\n> <Johannes.Schindelin@gmx.de>, see e.g.\n\nI think it would be helpful if you'd cc those folks involved, not just\nthe mailing list.\n"},{"id":"302437","messageId":"1mu13z0.1hye7bq1uqj26sM%lists@haller-berlin.de","threadId":"44119","inReplyTo":"ns1gr4$pjs$1@blaine.gmane.org","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2016-09-23T10:40:29Z","receivedAt":"2016-09-23T10:40:36Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Anatoly Borodin <anatoly.borodin@gmail.com> wrote:\n\n> PS There are also some pieces of \"what should work\" in these tests:\n> \n> t/t3409-rebase-preserve-merges.sh*\n> t/t3410-rebase-preserve-dropped-merges.sh*\n> t/t3411-rebase-preserve-around-merges.sh*\n> t/t3414-rebase-preserve-onto.sh*\n\nThanks, this is interesting; I'm having trouble understanding the tests\nthough. Some of them use rebase -p -i, but I don't understand why they\nuse -i, or why that even works in a test (i.e. why it doesn't open an\neditor).\n\nIn one test I saw \"GIT_EDITOR=: git rebase -i -p\", which I guess means\n\"use the initially given todo sheet unchanged\". I don't see any tests\nthat do an interactive rebase and actually change the todo list.\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"302438","messageId":"1mu0zrn.cs3kf31kttpjkM%lists@haller-berlin.de","threadId":"44119","inReplyTo":"CAGZ79kYoFH0dbQwvL_2JOtd8aybH8MKCtzy+p_88+QykVTGUtg@mail.gmail.com","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2016-09-23T10:40:29Z","receivedAt":"2016-09-23T10:40:41Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Stefan Beller <sbeller@google.com> wrote:\n\n> On Thu, Sep 22, 2016 at 12:48 PM, Kevin Daudt <me@ikke.info> wrote:\n> > On Thu, Sep 22, 2016 at 07:33:11PM +0000, Anatoly Borodin wrote:\n> >> Hi Stefan,\n> >>\n> >> this section was added to the manual in the commit\n> >> cddb42d2c58a9de9b2b5ef68817778e7afaace3e by \"Jonathan Nieder\"\n> >> <jrnieder@gmail.com> 6 years ago. Maybe he remembers better?\n> >>\n> >\n> > Just to make it clear, this section explicitly talks about 'bugs' with\n> > preserve-merges and interactive rebase.  Without the --preserve-merges\n> > option, those operations works as expected.\n> >\n> > The reason, as that section explains, is that it's not possible to store\n> > the merge structure in the flat todo list. I assume this means git\n> > internally remembers where the merge commit was, and then restores it\n> > while rebasing.\n> >\n> > Changing the order, or dropping commits might then give unexpected\n> > results.\n> >\n> \n> The commit message may help as well:\n> \n>     rebase -i -p: document shortcomings\n> \n>     The rebase --preserve-merges facility presents a list of commits\n>     in its instruction sheet and uses a separate table to keep\n>     track of their parents.  Unfortunately, in practice this means\n>     that with -p after most attempts to rearrange patches, some\n>     commits have the \"wrong\" parent and the resulting history is\n>     rarely what the caller expected.\n> \n>     Yes, it would be nice to fix that.  But first, add a warning to the\n>     manual to help the uninitiated understand what is going on.\n\nThanks, but all of this still talks about the issues in very generic\nterms (\"most attempts to rearrange patches\"). I'm interested in more\ndetails as to exactly what kind of attempts do or don't work. In\nparticular, I'm interested in fixup/squash commands (without reordering\nanything else), or dropping (non-merge) commits.\n\nI could of course experiment with these and try to find out myself, but\nI was hoping someone would just know the answer off the top of their\nhead, saving me some time.\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"302446","messageId":"xmqqvaxm1vc3.fsf@gitster.mtv.corp.google.com","threadId":"44119","inReplyTo":"1mu13z0.1hye7bq1uqj26sM%lists@haller-berlin.de","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-09-23T15:37:00Z","receivedAt":"2016-09-23T15:37:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"lists@haller-berlin.de (Stefan Haller) writes:\n\n> Thanks, this is interesting; I'm having trouble understanding the tests\n> though. Some of them use rebase -p -i, but I don't understand why they\n> use -i, or why that even works in a test (i.e. why it doesn't open an\n> editor).\n\nUpon starting up, tests dot-source t/test-lib.sh file and it\nunsets most of GIT_* environment variables to obtain a stable\ntesting environment that is not affected by things that testers\nmay have in their environment.\n\nThere is EDITOR=: in t/test-lib.sh, which was added in 2006 before\nGIT_EDITOR was invented.  That is the one in effect for git\nsubcommands that usually interacts with editors during the test,\nunless specific tests further override it with test_set_editor\nhelper.\n"},{"id":"302447","messageId":"1mu1iqo.1gihw0m1dcenmnM%lists@haller-berlin.de","threadId":"44119","inReplyTo":"xmqqvaxm1vc3.fsf@gitster.mtv.corp.google.com","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2016-09-23T15:50:41Z","receivedAt":"2016-09-23T15:50:51Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n\n> lists@haller-berlin.de (Stefan Haller) writes:\n> \n> > Thanks, this is interesting; I'm having trouble understanding the tests\n> > though. Some of them use rebase -p -i, but I don't understand why they\n> > use -i, or why that even works in a test (i.e. why it doesn't open an\n> > editor).\n> \n> Upon starting up, tests dot-source t/test-lib.sh file and it\n> unsets most of GIT_* environment variables to obtain a stable\n> testing environment that is not affected by things that testers\n> may have in their environment.\n> \n> There is EDITOR=: in t/test-lib.sh, which was added in 2006 before\n> GIT_EDITOR was invented.  That is the one in effect for git\n> subcommands that usually interacts with editors during the test,\n> unless specific tests further override it with test_set_editor\n> helper.\n\nThanks for the explanation. So this explains why -i works at all here;\nit doesn't explain why -i is used in these tests. Unless I'm missing\nsomething, they should all work with just -p.\n\nAnd I don't see any tests that do rebase -p -i and actually do something\ninteresting with the -i part. So my original question still remains. :-)\n\n\n-- \nStefan Haller\nBerlin, Germany\nhttp://www.haller-berlin.de/\n"},{"id":"302457","messageId":"4a9ebaaf-cf0e-7662-1799-df39597b43be@kdbg.org","threadId":"44119","inReplyTo":"1mu1iqo.1gihw0m1dcenmnM%lists@haller-berlin.de","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2016-09-23T19:24:12Z","receivedAt":"2016-09-23T19:24:20Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 23.09.2016 um 17:50 schrieb Stefan Haller:\n> And I don't see any tests that do rebase -p -i and actually do something\n> interesting with the -i part. So my original question still remains. :-)\n\n-i -p came first. -p without -i was bolted on later.\n\n-- Hannes\n\n"},{"id":"302464","messageId":"alpine.DEB.2.20.1609232300500.129229@virtualbox","threadId":"44119","inReplyTo":"CAGZ79kadpe5wG0gSpk-oasxCGuUp+3bSv-A4vhyFC+y0oL-+ww@mail.gmail.com","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-09-23T21:04:22Z","receivedAt":"2016-09-23T21:04:36Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Sep 2016, Stefan Beller wrote:\n\n> On Thu, Sep 22, 2016 at 2:01 PM, Anatoly Borodin\n> <anatoly.borodin@gmail.com> wrote:\n> > Hi Stefan,\n> >\n> > I've also done some archaeology and found that the original version of\n> > the merge preserving code was written by Johannes Schindelin\n> > <Johannes.Schindelin@gmx.de>, see e.g.\n> \n> I think it would be helpful if you'd cc those folks involved, not just\n> the mailing list.\n\nIndeed. It is quite tedious to re-Cc: people. Anatoly, please do not force\nme to put in that work in the future.\n\nAlso: I mentioned recently that I am not happy with the original design,\neither, and that I came up with a new design that I intend to port to the\nrebase--helper, once it is included in an official Git version:\n\nhttps://public-inbox.org/git/alpine.DEB.2.20.1609111027330.129229@virtualbox/\n\nCiao,\nJohannes\n"},{"id":"302465","messageId":"alpine.DEB.2.20.1609232305590.129229@virtualbox","threadId":"44119","inReplyTo":"1mu0zrn.cs3kf31kttpjkM%lists@haller-berlin.de","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2016-09-23T21:13:14Z","receivedAt":"2016-09-23T21:13:28Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Stefan,\n\nOn Fri, 23 Sep 2016, Stefan Haller wrote:\n\n> Stefan Beller <sbeller@google.com> wrote:\n> \n> > On Thu, Sep 22, 2016 at 12:48 PM, Kevin Daudt <me@ikke.info> wrote:\n> > > On Thu, Sep 22, 2016 at 07:33:11PM +0000, Anatoly Borodin wrote:\n> > >> Hi Stefan,\n> > >>\n> > >> this section was added to the manual in the commit\n> > >> cddb42d2c58a9de9b2b5ef68817778e7afaace3e by \"Jonathan Nieder\"\n> > >> <jrnieder@gmail.com> 6 years ago. Maybe he remembers better?\n> > >>\n> > >\n> > > Just to make it clear, this section explicitly talks about 'bugs' with\n> > > preserve-merges and interactive rebase.  Without the --preserve-merges\n> > > option, those operations works as expected.\n> > >\n> > > The reason, as that section explains, is that it's not possible to store\n> > > the merge structure in the flat todo list. I assume this means git\n> > > internally remembers where the merge commit was, and then restores it\n> > > while rebasing.\n> > >\n> > > Changing the order, or dropping commits might then give unexpected\n> > > results.\n> > >\n> > \n> > The commit message may help as well:\n> > \n> >     rebase -i -p: document shortcomings\n> > \n> >     The rebase --preserve-merges facility presents a list of commits\n> >     in its instruction sheet and uses a separate table to keep\n> >     track of their parents.  Unfortunately, in practice this means\n> >     that with -p after most attempts to rearrange patches, some\n> >     commits have the \"wrong\" parent and the resulting history is\n> >     rarely what the caller expected.\n> > \n> >     Yes, it would be nice to fix that.  But first, add a warning to the\n> >     manual to help the uninitiated understand what is going on.\n> \n> Thanks, but all of this still talks about the issues in very generic\n> terms (\"most attempts to rearrange patches\"). I'm interested in more\n> details as to exactly what kind of attempts do or don't work. In\n> particular, I'm interested in fixup/squash commands (without reordering\n> anything else), or dropping (non-merge) commits.\n> \n> I could of course experiment with these and try to find out myself, but\n> I was hoping someone would just know the answer off the top of their\n> head, saving me some time.\n\nThe fundamental problem here is the underlying design of bolting on the\n\"recreate a merge\" functionality onto the \"pick\" command.\n\nThat is, if you try to rebase non-linear commit history, it will still\ngenerate a linear list of \"pick <commit-name>\" lines, as if it were\nlinear, except that it will include the merge commits, too.\n\nIt then will try to guess what you want to do by recording which commit\nwas rewritten as which commit. And when it encounters a \"pick\" with a\nmerge commit, it will try to merge the *rewritten* commit.\n\nIn other words, the design does not allow for changing the tip of any\nmerged branch. Not reordering, not dropping.\n\nAnd I do not think that there is a way to fix that design. That is why I\ncame up with the Git garden shears (see the link I sent elsewhere in this\nthread).\n\nCiao,\nJohannes\n"},{"id":"302467","messageId":"CAGZ79kY_5FrMNrEBB19c4tZR+vFz-6uBudDtgVpWosL22mPzGg@mail.gmail.com","threadId":"44119","inReplyTo":"alpine.DEB.2.20.1609232305590.129229@virtualbox","subject":"Re: Limitiations of git rebase --preserve-merges --interactive","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-09-23T22:26:07Z","receivedAt":"2016-09-23T22:26:14Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Fri, Sep 23, 2016 at 2:13 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi Stefan,\n>\n> On Fri, 23 Sep 2016, Stefan Haller wrote:\n>\n>> Stefan Beller <sbeller@google.com> wrote:\n>>\n>> > On Thu, Sep 22, 2016 at 12:48 PM, Kevin Daudt <me@ikke.info> wrote:\n>> > > On Thu, Sep 22, 2016 at 07:33:11PM +0000, Anatoly Borodin wrote:\n>> > >> Hi Stefan,\n>> > >>\n>> > >> this section was added to the manual in the commit\n>> > >> cddb42d2c58a9de9b2b5ef68817778e7afaace3e by \"Jonathan Nieder\"\n>> > >> <jrnieder@gmail.com> 6 years ago. Maybe he remembers better?\n>> > >>\n>> > >\n>> > > Just to make it clear, this section explicitly talks about 'bugs' with\n>> > > preserve-merges and interactive rebase.  Without the --preserve-merges\n>> > > option, those operations works as expected.\n>> > >\n>> > > The reason, as that section explains, is that it's not possible to store\n>> > > the merge structure in the flat todo list. I assume this means git\n>> > > internally remembers where the merge commit was, and then restores it\n>> > > while rebasing.\n>> > >\n>> > > Changing the order, or dropping commits might then give unexpected\n>> > > results.\n>> > >\n>> >\n>> > The commit message may help as well:\n>> >\n>> >     rebase -i -p: document shortcomings\n>> >\n>> >     The rebase --preserve-merges facility presents a list of commits\n>> >     in its instruction sheet and uses a separate table to keep\n>> >     track of their parents.  Unfortunately, in practice this means\n>> >     that with -p after most attempts to rearrange patches, some\n>> >     commits have the \"wrong\" parent and the resulting history is\n>> >     rarely what the caller expected.\n>> >\n>> >     Yes, it would be nice to fix that.  But first, add a warning to the\n>> >     manual to help the uninitiated understand what is going on.\n>>\n>> Thanks, but all of this still talks about the issues in very generic\n>> terms (\"most attempts to rearrange patches\"). I'm interested in more\n>> details as to exactly what kind of attempts do or don't work. In\n>> particular, I'm interested in fixup/squash commands (without reordering\n>> anything else), or dropping (non-merge) commits.\n>>\n>> I could of course experiment with these and try to find out myself, but\n>> I was hoping someone would just know the answer off the top of their\n>> head, saving me some time.\n>\n> The fundamental problem here is the underlying design of bolting on the\n> \"recreate a merge\" functionality onto the \"pick\" command.\n>\n> That is, if you try to rebase non-linear commit history, it will still\n> generate a linear list of \"pick <commit-name>\" lines, as if it were\n> linear, except that it will include the merge commits, too.\n\nWhich on a more fundamental design level would be ok.\n(C.f. your shell history is a linear list of git commands, but it\ndeals just fine\nwith non linear DAGSs)\n\n>\n> It then will try to guess what you want to do by recording which commit\n> was rewritten as which commit. And when it encounters a \"pick\" with a\n> merge commit, it will try to merge the *rewritten* commit.\n\nInstead of guessing we'd need to differentiate between \"pick\" and \"pickmerge\",\nwhereas the later describes creating commits with more than one parent (i.e.\nthe prior pick line).\n\nI could imagine the \"pickmerge\" to list all additional parents (The\nfirst parent being\nthe previously picked commit) via symbolic naming:\n\n    pick 1234affe implement foo\n    pickmerge 3456feed origin/js/new-feature-1 # Merge origin/js/new-feature-1\n    pick 45678ead implement feature-2\n\nThe \"pickmerge\" would have first the merge tips, and then the old\nsubject line after\na # character.\n\n>\n> In other words, the design does not allow for changing the tip of any\n> merged branch. Not reordering, not dropping.\n\nI see how the current design is problematic as there is no argument\npossible that\nallows the user to correct the wrong guess.\n\n>\n> And I do not think that there is a way to fix that design. That is why I\n> came up with the Git garden shears (see the link I sent elsewhere in this\n> thread).\n\nI'll look into that.\n\nThanks,\nStefan\n"}]}