{"thread":{"id":"32677","subject":"git interactive rebase 'consume' command","startedAt":"2013-01-20T14:05:18Z","lastAt":"2013-01-21T19:05:45Z","messageCount":10,"participants":["Stephen Kelly","John Keeping","Junio C Hamano","Jeff King","Michael Haggerty"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"207304","messageId":"kdgtir$apt$1@ger.gmane.org","threadId":"32677","inReplyTo":null,"subject":"git interactive rebase 'consume' command","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2013-01-20T14:05:18Z","receivedAt":"2013-01-20T14:05:18Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"\nHi there,\n\nI find the fixup command during an interactive rebase useful.\n\nSometimes when cleaning up a branch, I end up in a situation like this:\n\n pick 07bc3c9 Good commit.\n pick 1313a5e Commit to fixup into c2f62a3.\n pick c2f62a3 Another commit.\n\n\nSo, I have to reorder the commits, and change 1313a5e to 'f'. An alternative \nwould be to squash 's' c2f62a3 into 1313a5e and clean up the commit message. \nThe problem with that is it ends up with the wrong author time information.\n\nSo, I usually reorder and then fixup, but that can also be problematic if I \nget a conflict during the re-order (which is quite likely).\n\nI would prefer to be able to mark a commit as 'should be consumed', so that:\n\n pick 07bc3c9 Good commit.\n consume 1313a5e Commit to fixup into c2f62a3.\n pick c2f62a3 Another commit.\n\nwill result in \n\n pick 07bc3c9 Good commit.\n pick 62a3c2f Another commit.\n\ndirectly.\n\nAny thoughts on that? \n\nThanks,\n\nSteve.\n"},{"id":"207305","messageId":"20130120141725.GL31172@serenity.lan","threadId":"32677","inReplyTo":"kdgtir$apt$1@ger.gmane.org","subject":"Re: git interactive rebase 'consume' command","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2013-01-20T14:17:25Z","receivedAt":"2013-01-20T14:17:25Z","isPatch":false,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Sun, Jan 20, 2013 at 03:05:18PM +0100, Stephen Kelly wrote:\n> I find the fixup command during an interactive rebase useful.\n> \n> Sometimes when cleaning up a branch, I end up in a situation like this:\n> \n>  pick 07bc3c9 Good commit.\n>  pick 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n> \n> So, I have to reorder the commits, and change 1313a5e to 'f'. An alternative \n> would be to squash 's' c2f62a3 into 1313a5e and clean up the commit message. \n> The problem with that is it ends up with the wrong author time information.\n> \n> So, I usually reorder and then fixup, but that can also be problematic if I \n> get a conflict during the re-order (which is quite likely).\n> \n> I would prefer to be able to mark a commit as 'should be consumed', so that:\n> \n>  pick 07bc3c9 Good commit.\n>  consume 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n> \n> will result in \n> \n>  pick 07bc3c9 Good commit.\n>  pick 62a3c2f Another commit.\n> \n> directly.\n> \n> Any thoughts on that? \n\nAre you aware of the \"--autosqush\" option to git-rebase (and the\n\"rebase.autosquash\" config setting)?  I find that using that combined\nwith the \"--fixup\" option to git-commit makes this workflow a lot more\nintuitive.\n\n(Which is not to say that I wouldn't find an option like 'consume'\nuseful but I find myself reordering the list very rarely since I started\nusing \"git commit --fixup=...\".)\n\n\nJohn\n"},{"id":"207306","messageId":"kdgukd$jlm$1@ger.gmane.org","threadId":"32677","inReplyTo":"20130120141725.GL31172@serenity.lan","subject":"Re: git interactive rebase 'consume' command","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2013-01-20T14:23:11Z","receivedAt":"2013-01-20T14:23:11Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"John Keeping wrote:\n>> Any thoughts on that?\n> \n> Are you aware of the \"--autosqush\" option to git-rebase (and the\n> \"rebase.autosquash\" config setting)?  I find that using that combined\n> with the \"--fixup\" option to git-commit makes this workflow a lot more\n> intuitive.\n\nYes, I'm aware of it, but I think it's not related to the proposal I made. \n\nMostly my proposal is about avoiding unnecessary conflict resolution.\n\nThanks,\n\nSteve.\n"},{"id":"207320","messageId":"7vk3r7llod.fsf@alter.siamese.dyndns.org","threadId":"32677","inReplyTo":"kdgtir$apt$1@ger.gmane.org","subject":"Re: git interactive rebase 'consume' command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-20T19:05:38Z","receivedAt":"2013-01-20T19:05:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Kelly <steveire@gmail.com> writes:\n\n> Hi there,\n>\n> I find the fixup command during an interactive rebase useful.\n>\n> Sometimes when cleaning up a branch, I end up in a situation like this:\n>\n>  pick 07bc3c9 Good commit.\n>  pick 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n>\n>\n> So, I have to reorder the commits, and change 1313a5e to 'f'. An alternative \n> would be to squash 's' c2f62a3 into 1313a5e and clean up the commit message. \n> The problem with that is it ends up with the wrong author time information.\n>\n> So, I usually reorder and then fixup, but that can also be problematic if I \n> get a conflict during the re-order (which is quite likely).\n>\n> I would prefer to be able to mark a commit as 'should be consumed', so that:\n>\n>  pick 07bc3c9 Good commit.\n>  consume 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n>\n> will result in \n>\n>  pick 07bc3c9 Good commit.\n>  pick 62a3c2f Another commit.\n>\n> directly.\n>\n> Any thoughts on that? \n\nSorry, but I do not understand what you are trying to solve.\n\nHow can 1313a5e, which fixes misakes made in c2f62a3, come before\nthat commit in the first place?\n"},{"id":"207321","messageId":"kdhfk6$von$1@ger.gmane.org","threadId":"32677","inReplyTo":"7vk3r7llod.fsf@alter.siamese.dyndns.org","subject":"Re: git interactive rebase 'consume' command","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2013-01-20T19:13:12Z","receivedAt":"2013-01-20T19:13:12Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"Junio C Hamano wrote:\n> Sorry, but I do not understand what you are trying to solve.\n> \n> How can 1313a5e, which fixes misakes made in c2f62a3, come before\n> that commit in the first place?\n\nOne scenario is something like this:\n\n Start with a clean HEAD (always a good idea :) )\n hack hack hack\n make multiple commits\n realize that a hunk you committed in an early patch belongs in a later one.\n use git rebase -i to fix it.\n\n\nIs that more clear?\n\nThanks,\n\nSteve.\n"},{"id":"207331","messageId":"7v8v7nli2a.fsf@alter.siamese.dyndns.org","threadId":"32677","inReplyTo":"kdhfk6$von$1@ger.gmane.org","subject":"Re: git interactive rebase 'consume' command","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-01-20T20:23:41Z","receivedAt":"2013-01-20T20:23:41Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stephen Kelly <steveire@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>> Sorry, but I do not understand what you are trying to solve.\n>> \n>> How can 1313a5e, which fixes misakes made in c2f62a3, come before\n>> that commit in the first place?\n>\n> One scenario is something like this:\n>\n>  Start with a clean HEAD (always a good idea :) )\n>  hack hack hack\n>  make multiple commits\n>  realize that a hunk you committed in an early patch belongs in a later one.\n>  use git rebase -i to fix it.\n>\n> Is that more clear?\n\nNot really.\n\nIf you think that the author timestamp is the time the author\nfinished working on the commit, shouldn't the squashed result get\nthe timestamp when you finished squashing, not the timestamp of\neither of the commits that were squashed?  Unlike \"fixup\" and\n\"reword\", the change you are making is very different from any of\nthe original constituent commmits, and you finished working on that\nchange when you squashed these commits into one.  Propagating the\ntimestamp from the later ones sounds equally wrong for that purpose.\n\nIn any case, the intent of the author timestamp is to record the\ntime the author _started_ working on the change and came up with an\ninitial, possibly a partial, draft.  It does not record the time\nwhen the commit was finalized.  \"git commit --amend\" preserves the\noriginal timestamp, doesn't it?\n\nIn your example:\n\n>  pick 07bc3c9 Good commit.\n>  pick 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n\nyou can view 1313a5e as a \"preparatory clean-up for the real change\nin c2f62a3\", which could be a separate commit in the final history.\nIf you choose to squash them together into one, the time you\nrecorded 1313a5e was when you started working on the combined\nchange, so it does not sound so wrong to take that author timestamp\nfor the result.\n"},{"id":"207356","messageId":"20130121014910.GA4792@sigill.intra.peff.net","threadId":"32677","inReplyTo":"7v8v7nli2a.fsf@alter.siamese.dyndns.org","subject":"Re: git interactive rebase 'consume' command","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2013-01-21T01:49:10Z","receivedAt":"2013-01-21T01:49:10Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Jan 20, 2013 at 12:23:41PM -0800, Junio C Hamano wrote:\n\n> In any case, the intent of the author timestamp is to record the\n> time the author _started_ working on the change and came up with an\n> initial, possibly a partial, draft.  It does not record the time\n> when the commit was finalized.  \"git commit --amend\" preserves the\n> original timestamp, doesn't it?\n\nAnd we have \"--reset-author\" if you want to do that. It seems like just\ndoing \"git commit --amend --reset-author\" at the end[1] would solve the\noriginal problem.  Perhaps that is something that we could better\nsupport directly from the instruction sheet.\n\n-Peff\n\n[1] or after an \"edit\" break in the instruction sheet, if it is in the\n    middle of a set of commits\n"},{"id":"207375","messageId":"kdiuu0$bvt$1@ger.gmane.org","threadId":"32677","inReplyTo":"7v8v7nli2a.fsf@alter.siamese.dyndns.org","subject":"Re: git interactive rebase 'consume' command","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2013-01-21T08:40:34Z","receivedAt":"2013-01-21T08:40:34Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"Junio C Hamano wrote:\n\n> Stephen Kelly <steveire@gmail.com> writes:\n\n>> One scenario is something like this:\n>>\n>>  Start with a clean HEAD (always a good idea :) )\n>>  hack hack hack\n>>  make multiple commits\n>>  realize that a hunk you committed in an early patch belongs in a later\n>>  one. use git rebase -i to fix it.\n>>\n>> Is that more clear?\n> \n> Not really.\n\nI think there are other scenarios, but I guess this won't happen anyway.\n\nThanks,\n\nSteve.\n"},{"id":"207388","messageId":"50FD20FA.8060906@alum.mit.edu","threadId":"32677","inReplyTo":"kdgtir$apt$1@ger.gmane.org","subject":"Re: git interactive rebase 'consume' command","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2013-01-21T11:05:30Z","receivedAt":"2013-01-21T11:05:30Z","isPatch":false,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 01/20/2013 03:05 PM, Stephen Kelly wrote:\n> I find the fixup command during an interactive rebase useful.\n> \n> Sometimes when cleaning up a branch, I end up in a situation like this:\n> \n>  pick 07bc3c9 Good commit.\n>  pick 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n> \n> \n> So, I have to reorder the commits, and change 1313a5e to 'f'. An alternative \n> would be to squash 's' c2f62a3 into 1313a5e and clean up the commit message. \n> The problem with that is it ends up with the wrong author time information.\n\nI do \"squash with successor then clean up commit message\" all the time.\n I had never worried (or even thought much) about the author time of the\nresulting commit.  I think I will continue not worrying about it :-)\n\nI think it would be great to have a shorthand for this operation in \"git\nrebase --interactive\" and I probably would have implemented it when I\nadded \"fixup\" if I had been able to think of a good name for it.  Even\nthough I do this sort of thing less frequently than \"fixup\", it still\ncomes up often enough that a special command for it would be useful.\n\n> So, I usually reorder and then fixup, but that can also be problematic if I \n> get a conflict during the re-order (which is quite likely).\n\nIt is perverse to have to turn a well-defined and manifestly\nconflict-free wish into one that has a good chance of conflicting, just\nbecause of a limitation of the tool.\n\n> I would prefer to be able to mark a commit as 'should be consumed', so that:\n> \n>  pick 07bc3c9 Good commit.\n>  consume 1313a5e Commit to fixup into c2f62a3.\n>  pick c2f62a3 Another commit.\n> \n> will result in \n> \n>  pick 07bc3c9 Good commit.\n>  pick 62a3c2f Another commit.\n> \n> directly.\n\nExcellent.  But the name is not self-explanatory.  And there is\nsomething different about your \"consume\" command:\n\nNormally, \"pick\" means that the commit on that line is the start of a\nnew commit unrelated to its predecessors.  And in general, the command\non one line only affects the lines that come before it, not the lines\nthat come after it.  Under your proposal \"consume\" would change the\nmeaning of the following line, namely by changing what its \"pick\" means.\n It might be more consistent to require the following line to be changed\nto \"squash\":\n\n    pick 07bc3c9 Good commit.\n    consume 1313a5e Commit to fixup into c2f62a3.\n    squash c2f62a3 Another commit.\n\nin which case the meaning of \"consume\" would be something like \"pick\nthis commit but not its commit message.  There would have to be a\nprohibition against generating commits with *no* commit messages, to\nprevent series like [consume, pick] or [consume, fix, pick] while\nallowing series like [consume, consume, squash, fix, fix].\n\nIf this is the interpretation, the name \"quiet/q\" might make things clearer.\n\nYet another approach would be to allow options on the commands.  For\nexample,\n\n    pick 07bc3c9 Good commit.\n    pick --quiet 1313a5e Commit to fixup into c2f62a3.\n    squash c2f62a3 Another commit.\n\nIn fact if options were implemented, then \"fixup\" would mean the same as\n\"squash --quiet\", \"reword\" could be written \"pick --edit\", and I'm sure\nthe new flexibility would make it easier to add other features (e.g.,\n\"pick --reset-author\").\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"207421","messageId":"50FD9189.8040807@gmail.com","threadId":"32677","inReplyTo":"50FD20FA.8060906@alum.mit.edu","subject":"Re: git interactive rebase 'consume' command","fromName":"Stephen Kelly","fromEmail":"steveire@gmail.com","sentAt":"2013-01-21T19:05:45Z","receivedAt":"2013-01-21T19:05:45Z","isPatch":false,"sender":{"key":"steveire@gmail.com","avatar":null},"body":"On 01/21/2013 12:05 PM, Michael Haggerty wrote:\n> It is perverse to have to turn a well-defined and manifestly\n> conflict-free wish into one that has a good chance of conflicting, just\n> because of a limitation of the tool.\n\nYes, I agree.\n\n>> I would prefer to be able to mark a commit as 'should be consumed', so that:\n>>\n>>   pick 07bc3c9 Good commit.\n>>   consume 1313a5e Commit to fixup into c2f62a3.\n>>   pick c2f62a3 Another commit.\n>>\n>> will result in\n>>\n>>   pick 07bc3c9 Good commit.\n>>   pick 62a3c2f Another commit.\n>>\n>> directly.\n> Excellent.  But the name is not self-explanatory.  And there is\n> something different about your \"consume\" command:\n>\n> Normally, \"pick\" means that the commit on that line is the start of a\n> new commit unrelated to its predecessors.  And in general, the command\n> on one line only affects the lines that come before it, not the lines\n> that come after it.  Under your proposal \"consume\" would change the\n> meaning of the following line, namely by changing what its \"pick\" means.\n\n>   It might be more consistent to require the following line to be changed\n> to \"squash\":\n\nI'm -1 on that. I value the simple format of the todo file. If I want to \nedit a commit, I type deif, reword - deir, fixup - deif. I'd like \nsomething equally simple like deic for this operation. There's also a \n'consistency' argument there, and one I prefer to your consistency \ninterpretation.\n\nThe same simplicity request applies to what you write below.\n\nThanks,\n\nSteve.\n\n>      pick 07bc3c9 Good commit.\n>      consume 1313a5e Commit to fixup into c2f62a3.\n>      squash c2f62a3 Another commit.\n>\n> in which case the meaning of \"consume\" would be something like \"pick\n> this commit but not its commit message.  There would have to be a\n> prohibition against generating commits with *no* commit messages, to\n> prevent series like [consume, pick] or [consume, fix, pick] while\n> allowing series like [consume, consume, squash, fix, fix].\n>\n> If this is the interpretation, the name \"quiet/q\" might make things clearer.\n>\n> Yet another approach would be to allow options on the commands.  For\n> example,\n>\n>      pick 07bc3c9 Good commit.\n>      pick --quiet 1313a5e Commit to fixup into c2f62a3.\n>      squash c2f62a3 Another commit.\n>\n> In fact if options were implemented, then \"fixup\" would mean the same as\n> \"squash --quiet\", \"reword\" could be written \"pick --edit\", and I'm sure\n> the new flexibility would make it easier to add other features (e.g.,\n> \"pick --reset-author\").\n>\n> Michael\n>\n"}]}