{"thread":{"id":"6733","subject":"git-am and workflow question","startedAt":"2007-02-08T00:34:05Z","lastAt":"2007-02-11T06:45:48Z","messageCount":7,"participants":["Kumar Gala","Junio C Hamano","Jakub Narebski","Michael S. Tsirkin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"33909","messageId":"FA0FC64E-75D2-4722-8BD9-F7E6C8C9AFA7@kernel.crashing.org","threadId":"6733","inReplyTo":null,"subject":"git-am and workflow question","fromName":"Kumar Gala","fromEmail":"galak@kernel.crashing.org","sentAt":"2007-02-08T00:34:05Z","receivedAt":"2007-02-08T00:34:05Z","isPatch":false,"sender":{"key":"galak@kernel.crashing.org","avatar":null},"body":"I poked around the docs and mailing lists but didn't find an answer  \nto my question some simple searches so I figured it might be easier  \nto just post a query to the list.\n\nSo my problem is that I'm applying some patches from a mbox and want  \nto be able to do some slight modifications before actually committing  \nthe change.  I was wondering how people solve this problem (if at all).\n\nthanks\n\n- kumar\n"},{"id":"33918","messageId":"7vodo5153j.fsf@assigned-by-dhcp.cox.net","threadId":"6733","inReplyTo":"FA0FC64E-75D2-4722-8BD9-F7E6C8C9AFA7@kernel.crashing.org","subject":"Re: git-am and workflow question","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T07:27:44Z","receivedAt":"2007-02-08T07:27:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kumar Gala <galak@kernel.crashing.org> writes:\n\n> I poked around the docs and mailing lists but didn't find an answer to\n> my question some simple searches so I figured it might be easier  to\n> just post a query to the list.\n>\n> So my problem is that I'm applying some patches from a mbox and want\n> to be able to do some slight modifications before actually committing\n> the change.  I was wondering how people solve this problem (if at all).\n\nI am one of the two people who have been applying e-mailed\npatches to a repository using git for the longest time, so I am\nprobably qualified to comment.  The other person is obviously\nLinus, but our workflows are a bit different.\n\nLinus's first pass is to read his mails in his usual e-mail\nclient; he saves potentially worthy patches in a separate\nmailbox for later review.  In the second pass, he opens the\nsaved mailbox in an editor, while fixing up bits in the commit\nmessages and diff text.  Then after making another pass for the\nfinal review, he applies them in a single batch.\n\nI tend to work more incrementally.  My \"first pass\" is to read\nmails and fire off kibitzing responses without doing anything\nother than marking potentially worthy patches for later review.\nMy second pass is actually applying the patch by piping each\ne-mail message from my e-mail client to \"git am -3 -s\", and if I\ndo not like something in the patch, I make corrections and then\nrun \"git commit --amend\".  My final pass is \"git log -p\", and if\nI find something I want to fix, I do \"git format-patch -$N\" and\n\"git reset --hard HEAD~$N\", fix it up in the editor by editing\nthe commit message and the diff text, and \"git am\" to rebind the\nbranch.\n\nIn short, there are two different approaches:\n\n - If a fix is something trivial, and if you are comfortable\n   editing diff text in your editor, then edit it before\n   applying.\n\n - If a fix is more involved, you are probably better off\n   stopping immediately after applying the patch you want to fix\n   up, make the fix in your working tree, and commit it with\n   \"git commit --amend\".\n"},{"id":"33928","messageId":"eqen7k$fb5$1@sea.gmane.org","threadId":"6733","inReplyTo":"FA0FC64E-75D2-4722-8BD9-F7E6C8C9AFA7@kernel.crashing.org","subject":"Re: git-am and workflow question","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2007-02-08T08:34:28Z","receivedAt":"2007-02-08T08:34:28Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"[Cc: git@vger.kernel.org]\n\nKumar Gala wrote:\n\n> I poked around the docs and mailing lists but didn't find an answer  \n> to my question some simple searches so I figured it might be easier  \n> to just post a query to the list.\n> \n> So my problem is that I'm applying some patches from a mbox and want  \n> to be able to do some slight modifications before actually committing  \n> the change.  I was wondering how people solve this problem (if at all).\n\nBoth git-am and git-applymbox have interactive mode, although I'm not\nsure how extensively interactive this mode is.\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"33942","messageId":"9A55745B-03D2-47B3-8359-FF2D9575502E@kernel.crashing.org","threadId":"6733","inReplyTo":"7vodo5153j.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-am and workflow question","fromName":"Kumar Gala","fromEmail":"galak@kernel.crashing.org","sentAt":"2007-02-08T16:07:31Z","receivedAt":"2007-02-08T16:07:31Z","isPatch":false,"sender":{"key":"galak@kernel.crashing.org","avatar":null},"body":"\nOn Feb 8, 2007, at 1:27 AM, Junio C Hamano wrote:\n\n> Kumar Gala <galak@kernel.crashing.org> writes:\n>\n>> I poked around the docs and mailing lists but didn't find an  \n>> answer to\n>> my question some simple searches so I figured it might be easier  to\n>> just post a query to the list.\n>>\n>> So my problem is that I'm applying some patches from a mbox and want\n>> to be able to do some slight modifications before actually committing\n>> the change.  I was wondering how people solve this problem (if at  \n>> all).\n>\n> I am one of the two people who have been applying e-mailed\n> patches to a repository using git for the longest time, so I am\n> probably qualified to comment.  The other person is obviously\n> Linus, but our workflows are a bit different.\n>\n> Linus's first pass is to read his mails in his usual e-mail\n> client; he saves potentially worthy patches in a separate\n> mailbox for later review.  In the second pass, he opens the\n> saved mailbox in an editor, while fixing up bits in the commit\n> messages and diff text.  Then after making another pass for the\n> final review, he applies them in a single batch.\n>\n> I tend to work more incrementally.  My \"first pass\" is to read\n> mails and fire off kibitzing responses without doing anything\n> other than marking potentially worthy patches for later review.\n> My second pass is actually applying the patch by piping each\n> e-mail message from my e-mail client to \"git am -3 -s\", and if I\n> do not like something in the patch, I make corrections and then\n> run \"git commit --amend\".  My final pass is \"git log -p\", and if\n> I find something I want to fix, I do \"git format-patch -$N\" and\n> \"git reset --hard HEAD~$N\", fix it up in the editor by editing\n> the commit message and the diff text, and \"git am\" to rebind the\n> branch.\n>\n> In short, there are two different approaches:\n>\n>  - If a fix is something trivial, and if you are comfortable\n>    editing diff text in your editor, then edit it before\n>    applying.\n>\n>  - If a fix is more involved, you are probably better off\n>    stopping immediately after applying the patch you want to fix\n>    up, make the fix in your working tree, and commit it with\n>    \"git commit --amend\".\n\nThanks.  Have there been any thoughts on having git-am apply the  \npatch and then let the user do some modifications before the commit?   \nI kinda did this by hand by doing the following:\n\ngit-am -i ...\n< suspend >\npatch -p1 < .dotest/patch\n< modify >\ngit-diff > .dotest/patch\n< cleanup >\n< resume >\n\n- k\n"},{"id":"33995","messageId":"7vveicxo23.fsf@assigned-by-dhcp.cox.net","threadId":"6733","inReplyTo":"9A55745B-03D2-47B3-8359-FF2D9575502E@kernel.crashing.org","subject":"Re: git-am and workflow question","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-08T22:49:24Z","receivedAt":"2007-02-08T22:49:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kumar Gala <galak@kernel.crashing.org> writes:\n\n> Thanks.  Have there been any thoughts on having git-am apply the patch\n> and then let the user do some modifications before the commit?   I\n> kinda did this by hand by doing the following:\n>\n> git-am -i ...\n> < suspend >\n> patch -p1 < .dotest/patch\n> < modify >\n> git-diff > .dotest/patch\n> < cleanup >\n> < resume >\n\nIf you are using \"am -i\", I think the above is already there (I\nmean, you should not have to do ^Z where you write <suspend>).\nWhen you get the interactive prompt:\n\n\tApply? [y]es/[n]o/[e]dit/[v]iew patch/[a]ccept all \n\nI think you can edit $dotest/patch in whatever way.\n\nHowever, if I were to do bulk application _with_ incremental\nfixup (which I think is a combination that would not work very\nwell for the way I work, though), I would probably have two\nwindows (I work inside \"screen\", so I would use two screens),\nand run \"am -i\" in one and run shell in the other.  Normally I\nwould just say 'y' to the prompt, and after applying something I\nmight want to do fixups, I would go to the shell, do fixups and\n\"commit --amend\", come back and let \"am -i\" to continue with the\nnext patch.\n"},{"id":"34143","messageId":"20070210221852.GC32216@mellanox.co.il","threadId":"6733","inReplyTo":"7vodo5153j.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-am and workflow question","fromName":"Michael S. Tsirkin","fromEmail":"mst@mellanox.co.il","sentAt":"2007-02-10T22:18:52Z","receivedAt":"2007-02-10T22:18:52Z","isPatch":false,"sender":{"key":"mst@kernel.org","avatar":null},"body":"> My second pass is actually applying the patch by piping each\n> e-mail message from my e-mail client to \"git am -3 -s\", and if I\n> do not like something in the patch, I make corrections and then\n> run \"git commit --amend\".\n\ngit-commit --amend seems to rewrite the commit author which is\nannoying if you only want to modify the log message a little. As a\nwork-around I copy the author info from the log and passing --author\nexplicitly, but is there an easier way?\n\n\n-- \nMST\n"},{"id":"34156","messageId":"7vps8hdwf7.fsf@assigned-by-dhcp.cox.net","threadId":"6733","inReplyTo":"20070210221852.GC32216@mellanox.co.il","subject":"Re: git-am and workflow question","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-02-11T06:45:48Z","receivedAt":"2007-02-11T06:45:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Michael S. Tsirkin\" <mst@mellanox.co.il> writes:\n\n>> My second pass is actually applying the patch by piping each\n>> e-mail message from my e-mail client to \"git am -3 -s\", and if I\n>> do not like something in the patch, I make corrections and then\n>> run \"git commit --amend\".\n>\n> git-commit --amend seems to rewrite the commit author which is\n> annoying if you only want to modify the log message a little. As a\n> work-around I copy the author info from the log and passing --author\n> explicitly, but is there an easier way?\n\nI am puzzled about this comment.  You should not have to do\nanything funky at all.\n\n\"commit --amend\" changes the committer information (because you\nare now committing something different and at a different time\nfrom what was recorded in the original commit object), but does\nnot touch the author information at all.\n\nWe _might_ have had a bug in an ancient version but I even doubt\nit.\n"}]}