{"thread":{"id":"53420","subject":"rebase -i: quick/inline reword","startedAt":"2020-05-07T04:27:54Z","lastAt":"2020-08-16T16:56:07Z","messageCount":13,"participants":["Solomon Ucko","Junio C Hamano","Sergey Organov","Jeff King","brian m. carlson","Johannes Altmanninger"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"397257","messageId":"CANtMP6oKN6Ueu=fqFYv2VhUP5S-ifbSzPTARvbEg4eV0pcRcHw@mail.gmail.com","threadId":"53420","inReplyTo":null,"subject":"rebase -i: quick/inline reword","fromName":"Solomon Ucko","fromEmail":"solly.ucko@gmail.com","sentAt":"2020-05-07T04:27:16Z","receivedAt":"2020-05-07T04:27:54Z","isPatch":false,"sender":{"key":"solly.ucko@gmail.com","avatar":"https://gravatar.com/avatar/487b91b46eda9ca603fb9b4b93c45d27c542f0dc7429382d695204832b0b2e52?d=mp&s=160"},"body":"Currently, `rebase -i` allows modifying the commit titles in the list, and\nthe modified title is shown in the lists of previous and next commands, but\nthe changes are not saved. Currently, modifying just the titles of many\ncommits requires `reword`ing each one and separately and consecutively editing\neach message, which is annoying when making small, repetitive edits, especially\nsince it requires double-checking each one separately. It would be much easier\nif there were a mode where any changes to the commit titles in the list\nmodified the commits' titles. Maybe `git rebase -i --reword`?\n\nAny thoughts, suggestions, questions, etc.?\n\nFYI, I am using git version 2.20.1 on `Linux ghostwheel 4.19.0-8-amd64 #1 SMP\nDebian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux`.\n\nSolomon Ucko\n\nP.S. This is my first time posting here, so let me know if I accidentally\nviolated any rules, e.g. etiquette or formatting.\n"},{"id":"397259","messageId":"xmqqzhak4a9o.fsf@gitster.c.googlers.com","threadId":"53420","inReplyTo":"CANtMP6oKN6Ueu=fqFYv2VhUP5S-ifbSzPTARvbEg4eV0pcRcHw@mail.gmail.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-05-07T04:52:19Z","receivedAt":"2020-05-07T04:52:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Solomon Ucko <solly.ucko@gmail.com> writes:\n\n> ... It would be much easier\n> if there were a mode where any changes to the commit titles in the list\n> modified the commits' titles. Maybe `git rebase -i --reword`?\n>\n> Any thoughts, suggestions, questions, etc.?\n\nIt is probably a bad idea, as it encourages a single-liner commit\nmessage without any body.\n\nEqually a bad idea, but perhaps slightly less evil, would be to add\na new verb that can be used to replace \"pick\" with, say, \"retitle\",\nand teach the sequencing machinery to pay attention to the updated\ntitle line only in that case.\n\nBesides, neither is really workable, as the single line text after\nthe abbreviated commit object name in the todo list is meant as an\noutput only \"informational\" comment on each step, and there are\nplans to add more than just the squashed title paragraph there\n(cf. *1* for an example).  Even without such a future change, the\nmaterial there may not be just the commit title, if I am reading\nthe code correctly, when rebase.instructionFormat is in use.\n\n\n[Reference]\n\n*1* https://lore.kernel.org/git/pull.757.v3.git.git.1586573067.gitgitgadget@gmail.com/\n"},{"id":"397279","messageId":"87imh8m346.fsf@osv.gnss.ru","threadId":"53420","inReplyTo":"CANtMP6oKN6Ueu=fqFYv2VhUP5S-ifbSzPTARvbEg4eV0pcRcHw@mail.gmail.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-05-07T10:49:29Z","receivedAt":"2020-05-07T10:49:34Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Solomon Ucko <solly.ucko@gmail.com> writes:\n\n> Currently, `rebase -i` allows modifying the commit titles in the list, and\n> the modified title is shown in the lists of previous and next commands, but\n> the changes are not saved. Currently, modifying just the titles of many\n> commits requires `reword`ing each one and separately and consecutively editing\n> each message, which is annoying when making small, repetitive edits, especially\n> since it requires double-checking each one separately. It would be much easier\n> if there were a mode where any changes to the commit titles in the list\n> modified the commits' titles. Maybe `git rebase -i --reword`?\n>\n> Any thoughts, suggestions, questions, etc.?\n\nYes, thanks for raising the issue!\n\nI've needed the feature many times myself, but then, as Junio already\ndescribed in his reply, I realized it's likely a no-go with current\ndesign of the todo lists. Changing just the titles probably still could\nbe implemented in a useful way (as with your --reword suggestion), but\nits application is in fact rather limited, so maybe isn't worth the\ntrouble.\n\nIt'd be really nice if it were possible to, say, search&replace in, or\nspell-check, interactively, all the commit messages (including titles)\nof a bunch of commits to be published, all in a single file handled by\nsingle rebase run.\n\nThis is a feature that I'd like to see being considered if and when we\ndecide to design a history editing feature that is more powerful than\ncurrent dos-batch-files-alike processing enhanced with comefrom labels.\n\n-- Sergey\n"},{"id":"397284","messageId":"20200507114630.GC3027470@coredump.intra.peff.net","threadId":"53420","inReplyTo":"xmqqzhak4a9o.fsf@gitster.c.googlers.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2020-05-07T11:46:30Z","receivedAt":"2020-05-07T11:46:33Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 06, 2020 at 09:52:19PM -0700, Junio C Hamano wrote:\n\n> Solomon Ucko <solly.ucko@gmail.com> writes:\n> \n> > ... It would be much easier\n> > if there were a mode where any changes to the commit titles in the list\n> > modified the commits' titles. Maybe `git rebase -i --reword`?\n> >\n> > Any thoughts, suggestions, questions, etc.?\n> \n> It is probably a bad idea, as it encourages a single-liner commit\n> message without any body.\n\nThere is another legitimate use (or at least one I have wished for many\ntimes): when manipulating the todo list in my editor to choose patches\nfor editing, I sometimes notice a typo in the title and correct it. And\nof course that does no good, and I get annoyed. You'd think I would have\nlearned after all these years, but I continue to make the same mistake.\n;)\n\nI've often wished that changes there would be quietly persisted. Your\n\"retitle\" suggestion would help, but I'd have to remember to use it (I\ncould equally well just remember to use \"reword\", which I clearly\ndon't).\n\nSo I've thought about suggesting this myself in the past, but I held\nback for the reasons you mentioned below (i.e., that it's not a\ntrustworthy version of the subject in the first place).\n\nI'm not sure if it's solvable or worth solving, but I thought I'd add my\n2 cents that the _desire_ at least isn't totally without merit.\n\n-Peff\n"},{"id":"397289","messageId":"87zhakgcs1.fsf@osv.gnss.ru","threadId":"53420","inReplyTo":"20200507114630.GC3027470@coredump.intra.peff.net","subject":"Re: rebase -i: quick/inline reword","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-05-07T12:17:18Z","receivedAt":"2020-05-07T12:17:24Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Wed, May 06, 2020 at 09:52:19PM -0700, Junio C Hamano wrote:\n>\n>> Solomon Ucko <solly.ucko@gmail.com> writes:\n>> \n>> > ... It would be much easier\n>> > if there were a mode where any changes to the commit titles in the list\n>> > modified the commits' titles. Maybe `git rebase -i --reword`?\n>> >\n>> > Any thoughts, suggestions, questions, etc.?\n>> \n>> It is probably a bad idea, as it encourages a single-liner commit\n>> message without any body.\n>\n> There is another legitimate use (or at least one I have wished for many\n> times): when manipulating the todo list in my editor to choose patches\n> for editing, I sometimes notice a typo in the title and correct it. And\n> of course that does no good, and I get annoyed. You'd think I would have\n> learned after all these years, but I continue to make the same mistake.\n> ;)\n>\n> I've often wished that changes there would be quietly persisted.\n\nThat's exactly my case as well.\n\n-- Sergey\n"},{"id":"397308","messageId":"CANtMP6pSgU2WfuHVug-dj=10LNOL-mLL-5rTio=q3GjUs5MrgQ@mail.gmail.com","threadId":"53420","inReplyTo":"xmqqzhak4a9o.fsf@gitster.c.googlers.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Solomon Ucko","fromEmail":"solly.ucko@gmail.com","sentAt":"2020-05-07T14:01:55Z","receivedAt":"2020-05-07T14:02:36Z","isPatch":false,"sender":{"key":"solly.ucko@gmail.com","avatar":"https://gravatar.com/avatar/487b91b46eda9ca603fb9b4b93c45d27c542f0dc7429382d695204832b0b2e52?d=mp&s=160"},"body":"On Thu, May 7, 2020 at 12:52 AM Junio C Hamano <gitster@pobox.com> wrote:\n> It is probably a bad idea, as it encourages a single-liner commit\n> message without any body.\n\nYou could modify the title and keep the rest of the message. You could display\nthe modified message similarly to how `reword` does, to allow modifying the\nrest of the message.\n\n> Besides, neither is really workable, as the single line text after\n> the abbreviated commit object name in the todo list is meant as an\n> output only \"informational\" comment on each step, and there are\n> plans to add more than just the squashed title paragraph there\n> (cf. *1* for an example).  Even without such a future change, the\n> material there may not be just the commit title, if I am reading\n> the code correctly, when rebase.instructionFormat is in use.\n\nYou could have some sort of separator between the title and the rest of the\ninfo. You could disable the extra info when using this mode, if it's a\ncommand-line flag. You could require the title to be at the end to use this\nfeature, possibly after some sort of start marker.\n\nSolomon Ucko\n"},{"id":"397382","messageId":"20200508000538.GE7234@camp.crustytoothpaste.net","threadId":"53420","inReplyTo":"87imh8m346.fsf@osv.gnss.ru","subject":"Re: rebase -i: quick/inline reword","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-05-08T00:05:38Z","receivedAt":"2020-05-08T00:06:15Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-05-07 at 10:49:29, Sergey Organov wrote:\n> It'd be really nice if it were possible to, say, search&replace in, or\n> spell-check, interactively, all the commit messages (including titles)\n> of a bunch of commits to be published, all in a single file handled by\n> single rebase run.\n\nIt is possible to do this with a bit of shell scripting.  You can run\n\"git rebase -x\" if you want to check every commit in a certain way.\n\nIf instead you'd like to modify all the commit messages, you can use\nsomething like this:\n\n  GIT_SEQUENCE_EDITOR=\"sed -e 's/^pick /reword /'\" \\\n  GIT_EDITOR=\"some-shell-script-that-modifies-its-file-argument-in-place\" \\\n  git rebase -i BASE\n\nI use something similar as an alias to automatically squash all my\nsquash and fixup commits without needing to open an editor:\n\n  !f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash \"$@\"; };f\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"397439","messageId":"87sggab031.fsf@osv.gnss.ru","threadId":"53420","inReplyTo":"20200508000538.GE7234@camp.crustytoothpaste.net","subject":"Re: rebase -i: quick/inline reword","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-05-08T21:14:58Z","receivedAt":"2020-05-08T21:15:04Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> On 2020-05-07 at 10:49:29, Sergey Organov wrote:\n>> It'd be really nice if it were possible to, say, search&replace in, or\n>> spell-check, interactively, all the commit messages (including titles)\n>> of a bunch of commits to be published, all in a single file handled by\n>> single rebase run.\n>\n> It is possible to do this with a bit of shell scripting.  You can run\n> \"git rebase -x\" if you want to check every commit in a certain way.\n>\n> If instead you'd like to modify all the commit messages, you can use\n> something like this:\n>\n>   GIT_SEQUENCE_EDITOR=\"sed -e 's/^pick /reword /'\" \\\n>   GIT_EDITOR=\"some-shell-script-that-modifies-its-file-argument-in-place\" \\\n>   git rebase -i BASE\n>\n> I use something similar as an alias to automatically squash all my\n> squash and fixup commits without needing to open an editor:\n>\n>   !f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash \"$@\"; };f\n\nThese are very good and useful features indeed, and they are examples of\nbatch processing that is very handy for automation, but lacks\ninteractivity. What I rather have in mind is being able to put all the\nmessages /simultaneously/ into my favorite text editor and edit them\nmore or less freely till I'm satisfied, then \"commit\" the overall result\nby passing it back to git. Essentially \"git rebase -i\" on steroids.\n\n-- Sergey\n"},{"id":"403782","messageId":"20200816001401.1144752-1-aclopte@gmail.com","threadId":"53420","inReplyTo":"87sggab031.fsf@osv.gnss.ru","subject":"Re: rebase -i: quick/inline reword","fromName":"Johannes Altmanninger","fromEmail":"aclopte@gmail.com","sentAt":"2020-08-16T00:14:01Z","receivedAt":"2020-08-16T00:14:19Z","isPatch":false,"sender":{"key":"aclopte@gmail.com","avatar":"https://avatars.githubusercontent.com/u/6853872?v=4"},"body":"> >   !f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash \"$@\"; };f\n> \n> These are very good and useful features indeed, and they are examples of\n> batch processing that is very handy for automation, but lacks\n> interactivity. What I rather have in mind is being able to put all the\n> messages /simultaneously/ into my favorite text editor and edit them\n> more or less freely till I'm satisfied, then \"commit\" the overall result\n> by passing it back to git. Essentially \"git rebase -i\" on steroids.\n\ngit-revise is a third-party tool that can do this\n\nhttps://git-revise.readthedocs.io/en/latest/\n\nFor example, \"git revise -ie\" allows you to edit all commit messages in\n@{u}..HEAD in a single buffer.\n"},{"id":"403785","messageId":"xmqq364n5f0b.fsf@gitster.c.googlers.com","threadId":"53420","inReplyTo":"20200816001401.1144752-1-aclopte@gmail.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-08-16T05:36:04Z","receivedAt":"2020-08-16T05:36:09Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Altmanninger <aclopte@gmail.com> writes:\n\n>> >   !f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash \"$@\"; };f\n>> \n>> These are very good and useful features indeed, and they are examples of\n>> batch processing that is very handy for automation, but lacks\n>> interactivity. What I rather have in mind is being able to put all the\n>> messages /simultaneously/ into my favorite text editor and edit them\n>> more or less freely till I'm satisfied, then \"commit\" the overall result\n>> by passing it back to git. Essentially \"git rebase -i\" on steroids.\n>\n> git-revise is a third-party tool that can do this\n>\n> https://git-revise.readthedocs.io/en/latest/\n>\n> For example, \"git revise -ie\" allows you to edit all commit messages in\n> @{u}..HEAD in a single buffer.\n\nI only looked at its description but the UI the tool does it with\nlooks quite obvious and intuitive.  From its source, the \"merge\"\noperation does not seem to handle merging a side branch that renamed\nfiles, but that should be OK most of the time, I presume.\n\nNice.\n"},{"id":"403794","messageId":"87mu2upyra.fsf@osv.gnss.ru","threadId":"53420","inReplyTo":"20200816001401.1144752-1-aclopte@gmail.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-08-16T12:21:29Z","receivedAt":"2020-08-16T12:21:38Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Johannes Altmanninger <aclopte@gmail.com> writes:\n\n>> >   !f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash \"$@\"; };f\n>> \n>> These are very good and useful features indeed, and they are examples of\n>> batch processing that is very handy for automation, but lacks\n>> interactivity. What I rather have in mind is being able to put all the\n>> messages /simultaneously/ into my favorite text editor and edit them\n>> more or less freely till I'm satisfied, then \"commit\" the overall result\n>> by passing it back to git. Essentially \"git rebase -i\" on steroids.\n>\n> git-revise is a third-party tool that can do this\n>\n> https://git-revise.readthedocs.io/en/latest/\n>\n> For example, \"git revise -ie\" allows you to edit all commit messages in\n> @{u}..HEAD in a single buffer.\n\nYeah, exactly what is needed! And there are packages for it both in\nDebian and Ubuntu, double win! Thanks for sharing!\n\n-- Sergey\n"},{"id":"403795","messageId":"87imdipymt.fsf@osv.gnss.ru","threadId":"53420","inReplyTo":"xmqq364n5f0b.fsf@gitster.c.googlers.com","subject":"Re: rebase -i: quick/inline reword","fromName":"Sergey Organov","fromEmail":"sorganov@gmail.com","sentAt":"2020-08-16T12:24:10Z","receivedAt":"2020-08-16T12:24:18Z","isPatch":false,"sender":{"key":"sorganov@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8501568?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Johannes Altmanninger <aclopte@gmail.com> writes:\n>\n>>> >   !f() { GIT_SEQUENCE_EDITOR=true git rebase -i --autosquash \"$@\"; };f\n>>> \n>>> These are very good and useful features indeed, and they are examples of\n>>> batch processing that is very handy for automation, but lacks\n>>> interactivity. What I rather have in mind is being able to put all the\n>>> messages /simultaneously/ into my favorite text editor and edit them\n>>> more or less freely till I'm satisfied, then \"commit\" the overall result\n>>> by passing it back to git. Essentially \"git rebase -i\" on steroids.\n>>\n>> git-revise is a third-party tool that can do this\n>>\n>> https://git-revise.readthedocs.io/en/latest/\n>>\n>> For example, \"git revise -ie\" allows you to edit all commit messages in\n>> @{u}..HEAD in a single buffer.\n>\n> I only looked at its description but the UI the tool does it with\n> looks quite obvious and intuitive.  From its source, the \"merge\"\n> operation does not seem to handle merging a side branch that renamed\n> files, but that should be OK most of the time, I presume.\n\nFrom the docs:\n\nNo merge commits may occur between the target commit and HEAD, as\nrewriting them is not supported. \n\n>\n> Nice.\n\nYeah, it is!\n\n-- Sergey\n"},{"id":"403797","messageId":"xmqqy2me4jj6.fsf@gitster.c.googlers.com","threadId":"53420","inReplyTo":"87imdipymt.fsf@osv.gnss.ru","subject":"Re: rebase -i: quick/inline reword","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-08-16T16:55:57Z","receivedAt":"2020-08-16T16:56:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sergey Organov <sorganov@gmail.com> writes:\n\n>> I only looked at its description but the UI the tool does it with\n>> looks quite obvious and intuitive.  From its source, the \"merge\"\n>> operation does not seem to handle merging a side branch that renamed\n>> files, but that should be OK most of the time, I presume.\n>\n> From the docs:\n>\n> No merge commits may occur between the target commit and HEAD, as\n> rewriting them is not supported. \n\nI didn't read the documentation that deeply, but it's irrelevant\nthat the tool can handle only a single strand of pearls.\n\nYou need a merge machinery to implement even a cherry-pick of a\nsingle parent commit; an obvious way to implement cherry-pick of\ncommit C on HEAD is to perform three-way merges between C and HEAD,\npretending as if C^1 is their sole common ancestor.\n\nOur cherry-pick uses the merge-recursive machinery to do so, and\nbecause the sequencer inherited the idea and implementation, \"git\nrebase -i\" does the same.  They instead use their own written in\nPython to merge at the tree-level and farms the content-level merge\nout to \"git merge-file\".\n\nThe \"recursive\" part of the \"merge-recursive\" machinery we use does\nnot help cherry-pick at all (as we use only one \"common\"), but it\nhandles renames.  They can do the same in their merge_trees(), but\nthey currently don't.\n\nBut as I said, that should be OK most of the time, I would think.\n\n>> Nice.\n>\n> Yeah, it is!\n\nThat part is still true ;-)\n"}]}