{"thread":{"id":"45817","subject":"git loses a commit after reordering.","startedAt":"2017-04-27T08:24:25Z","lastAt":"2017-05-02T14:29:51Z","messageCount":5,"participants":["Nikita Orlov","Kevin Daudt","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"318059","messageId":"1493278996.239768474@f402.i.mail.ru","threadId":"45817","inReplyTo":null,"subject":"git loses a commit after reordering.","fromName":"Nikita Orlov","fromEmail":"fatemail@mail.ru","sentAt":"2017-04-27T07:43:16Z","receivedAt":"2017-04-27T08:24:25Z","isPatch":false,"sender":{"key":"fatemail@mail.ru","avatar":null},"body":"Hello, my name is Nikita (male).\n\nCould you explain this (subject) is a bug or a feature?\n\nI follow Pro Git Reordering Commits (https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History) to reorder commits and lose one without any conflict.\n\nI've got git under Windows 10 Enterprise 64-bit installed through Chocolatey.\n\n> choco list -l git\nChocolatey v0.10.5\nchocolatey 0.10.5\ngit 2.12.2.2\ngitpad 1.2\nmsysgit 1.7.10.20120526\n4 packages installed.\n\n$ git --version\ngit version 2.12.2.windows.1\n\nExample.\n\nThere are two branches:\n- master\n- feature-branch\n\nfeature-branch is on master.\n\nMyPC MINGW64 /path/to/repository (feature-branch)\n\n$ git log -9 --oneline\n5045d1eca Merge branch 'feature-3' into 'feature-branch'\n006fc549d Done Task 3\na2a52441e Merge branch 'feature-2' into 'feature-branch'\ne73527115 Done Task 2\nf0454685e Merge branch 'feature-1' into 'feature-branch'\n3ab82e4c6 Done Task 1\nf15037d64 Some independent changes 2\ncba3ebb4e Some independent changes 1\nbc19473cf Head of master\n\n$ git rebase -i -p master\n\nI change the rebase script from:\n\npick cba3ebb4e Some independent changes 1\npick f15037d64 Some independent changes 2\npick 3ab82e4c6 Done Task 1\npick f0454685e Merge branch 'feature-1' into 'feature-branch'\npick e73527115 Done Task 2\npick a2a52441e Merge branch 'feature-2' into 'feature-branch'\npick 006fc549d Done Task 3\npick 5045d1eca Merge branch 'feature-3' into 'feature-branch'\n\nto:\n\npick f15037d64 Some independent changes 2\npick cba3ebb4e Some independent changes 1\npick 3ab82e4c6 Done Task 1\npick f0454685e Merge branch 'feature-1' into 'feature-branch'\npick e73527115 Done Task 2\npick a2a52441e Merge branch 'feature-2' into 'feature-branch'\npick 006fc549d Done Task 3\npick 5045d1eca Merge branch 'feature-3' into 'feature-branch'\n\nNo any conflict and I see:\nSuccessfully rebased and updated refs/heads/feature-branch.\n\n$ git log -9 --oneline\n47e579ce0 Merge branch 'feature-3' into 'feature-branch'\na7c6b8b8e Done Task 3\n5df7ce105 Merge branch 'feature-2' into 'feature-branch'\n0197797d7 Done Task 2\ne680488fe Merge branch 'feature-1' into 'feature-branch'\n731a57580 Done Task 1\n10da9cd85 Some independent changes 2\nbc19473cf Head of master\nd91947abd Commit under the head of master\n\n\"Some independent changes 1\" is missed and its changes are missed as well.\n\nI tried to move another commit to a farther distance below but there was still only one missed commit.\n\nCould you explain it?\n\nThank you in advance and sorry for my English.\n\nBest, Nikita\n"},{"id":"318249","messageId":"20170429225642.GA25902@alpha.vpn.ikke.info","threadId":"45817","inReplyTo":"1493278996.239768474@f402.i.mail.ru","subject":"Re: git loses a commit after reordering.","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2017-04-29T22:56:42Z","receivedAt":"2017-04-29T23:02:15Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Thu, Apr 27, 2017 at 10:43:16AM +0300, Nikita Orlov wrote:\n> Hello, my name is Nikita (male).\n> \n> Could you explain this (subject) is a bug or a feature?\n> \n> [snip]\n> \n> \"Some independent changes 1\" is missed and its changes are missed as well.\n> \n> I tried to move another commit to a farther distance below but there was still only one missed commit.\n> \n> Could you explain it?\n> \n> Thank you in advance and sorry for my English.\n> \n> Best, Nikita\n\n[man git-rebase][0] mentions this under the bug section:\n\n> The todo list presented by --preserve-merges --interactive does not\n> represent the topology of the revision graph. Editing commits and\n> rewording their commit messages should work fine, but attempts to\n> reorder commits tend to produce counterintuitive results.\n\nNot sure if this is the case here, but it at least confirms that rebase\n--preserve-merges was not meant to reorder commits.\n\nSee [this][1] thread for more background on this limitation.\n\n[0]:https://git-scm.com/docs/git-rebase#_bugs\n[1]:https://public-inbox.org/git/1mtveu4.19lvgi1c0hmhaM%25lists@haller-berlin.de/\n"},{"id":"318372","messageId":"1493643894.701604094@f346.i.mail.ru","threadId":"45817","inReplyTo":"20170429225642.GA25902@alpha.vpn.ikke.info","subject":"Re[2]: git loses a commit after reordering.","fromName":"Nikita Orlov","fromEmail":"fatemail@mail.ru","sentAt":"2017-05-01T13:04:54Z","receivedAt":"2017-05-01T14:55:30Z","isPatch":false,"sender":{"key":"fatemail@mail.ru","avatar":null},"body":">On Sun, 30 Apr 2017, 1:56 +03:00 from Kevin Daudt <me@ikke.info>:\n>Not sure if this is the case here, but it at least confirms that rebase\n>--preserve-merges was not meant to reorder commits.\n>\n>See [this][1] thread for more background on this limitation.\n>\n>[0]: https://git-scm.com/docs/git-rebase#_bugs\n>[1]: https://public-inbox.org/git/1mtveu4.19lvgi1c0hmhaM%25lists@haller-berlin.de/\n\nThis is it. As I understand git-rebase--helper is an attempt to fix the bug.\nBut it's still in development, isn't it?\n\nIs there a simple/the right way how to do reordering without losing\nmerge commits now? E.g., I've done it by git-cherry-pick during interactive rebasing.\n\nThanks.\n\n--\nNikita Orlov\n"},{"id":"318425","messageId":"xmqqwpa0f8zm.fsf@gitster.mtv.corp.google.com","threadId":"45817","inReplyTo":"1493643894.701604094@f346.i.mail.ru","subject":"Re: git loses a commit after reordering.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-05-01T23:33:17Z","receivedAt":"2017-05-01T23:33:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nikita Orlov <fatemail@mail.ru> writes:\n\n>>On Sun, 30 Apr 2017, 1:56 +03:00 from Kevin Daudt <me@ikke.info>:\n>>Not sure if this is the case here, but it at least confirms that rebase\n>>--preserve-merges was not meant to reorder commits.\n>>\n>>See [this][1] thread for more background on this limitation.\n>>\n>>[0]: https://git-scm.com/docs/git-rebase#_bugs\n>>[1]: https://public-inbox.org/git/1mtveu4.19lvgi1c0hmhaM%25lists@haller-berlin.de/\n>\n> This is it. As I understand git-rebase--helper is an attempt to fix the bug.\n> But it's still in development, isn't it?\n\nThe impression I have been getting is that \"rebase -p\" was abandoned\nby its author, and the recent rebase--helper work is solely for\nre-implementing the performance sensitive part of \"-i\" (interactive).\n"},{"id":"318502","messageId":"alpine.DEB.2.20.1705021608580.3480@virtualbox","threadId":"45817","inReplyTo":"xmqqwpa0f8zm.fsf@gitster.mtv.corp.google.com","subject":"Re: git loses a commit after reordering.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2017-05-02T14:29:37Z","receivedAt":"2017-05-02T14:29:51Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Junio, Kevin & Nikita,\n\nOn Mon, 1 May 2017, Junio C Hamano wrote:\n\n> Nikita Orlov <fatemail@mail.ru> writes:\n> \n> >>On Sun, 30 Apr 2017, 1:56 +03:00 from Kevin Daudt <me@ikke.info>:\n> >>Not sure if this is the case here, but it at least confirms that rebase\n> >>--preserve-merges was not meant to reorder commits.\n> >>\n> >>See [this][1] thread for more background on this limitation.\n> >>\n> >>[0]: https://git-scm.com/docs/git-rebase#_bugs\n> >>[1]: https://public-inbox.org/git/1mtveu4.19lvgi1c0hmhaM%25lists@haller-berlin.de/\n> >\n> > This is it. As I understand git-rebase--helper is an attempt to fix the bug.\n> > But it's still in development, isn't it?\n> \n> The impression I have been getting is that \"rebase -p\" was abandoned\n> by its author, and the recent rebase--helper work is solely for\n> re-implementing the performance sensitive part of \"-i\" (interactive).\n\nIndeed. The design of `-p` does not really allow for it to be fixed, as it\noverloads the meaning of `pick` to also \"pick a merge commit\". This\nfurther limits the usefulness of the `-p` feature by not allowing to\nadjust merge commits to merge anything else than the rebased commit^2 into\nanything else than the rebased commit^, which is kind of a realy big\ndesign bug.\n\nBut then, I never meant for -p to be interactive, either, and others made\nit so. Therefore I refuse to take the blame for that.\n\nAfter my rebase-i-extra patch series (which Junio currently calls\nrebase-i-final) will be accepted, I plan to do a bit more work on the\nrebase -i front.\n\nOne thing I have in mind is to implement a new --recreate-merges option.\nIt will be closely modeled after the functionality of my Git garden shears\n[*1*] that I used to maintain Git for Windows' dozens of patch series on\ntop of git.git's `maint` branch.\n\nEssentially, I want to introduce new commands (that are implemented as\n`exec` calls in the Git garden shears, with the noticeable performance\nimplications on Windows) that\n\n- allow to mark the current commit with a label,\n\n- reset HEAD to a given label\n\n- merge a branch by a given label\n\nThese commands would be new commands, and therefore backwards-compatible\nwith the current command set. No need for special-casing `pick` in the\ncase of the new mode.\n\nAnd then I would patch in the new --recreate-merges option simply by\ngenerating a todo list using those new commands.\n\nThe todo list may look somewhat like this:\n\n\tmark onto\n\n\t# branch <my-cool-feature>\n\tpick deadbee5 lay some groundwork\n\tpick beeb0bab implement the cool feature\n\tpick deebadee document the cool feature\n\tmark my-cool-feature\n\n\treset onto\n\tpick cabbadab fix a tyop\n\tremerge d00beedo my-cool-feature\n\nwhere `remerge <original-commit> <label>` would merge the commit with the\ngiven label using the commit message of the original merge commit.\n\nThis would result in a history like this:\n\n------------------------------------------ fix a tyop - Merge my-cool-feature\n \\                                                    /\n  lay some groundwork - implement ... - document ... -\n\nIf you have an idea for a better name than `remerge` (I do want to leave\n`merge` as command to create new merge commits that have not been there\nbefore), I'd like to hear your suggestion.\n\nCiao,\nJohannes\n\nFootnote *1*:\nhttps://github.com/git-for-windows/build-extra/blob/master/shears.sh\n"}]}