Kumar Gala <galak@xxxxxxxxxxxxxxxxxxx> writes: > I poked around the docs and mailing lists but didn't find an answer to > my question some simple searches so I figured it might be easier to > just post a query to the list. > > So my problem is that I'm applying some patches from a mbox and want > to be able to do some slight modifications before actually committing > the change. I was wondering how people solve this problem (if at all). I am one of the two people who have been applying e-mailed patches to a repository using git for the longest time, so I am probably qualified to comment. The other person is obviously Linus, but our workflows are a bit different. Linus's first pass is to read his mails in his usual e-mail client; he saves potentially worthy patches in a separate mailbox for later review. In the second pass, he opens the saved mailbox in an editor, while fixing up bits in the commit messages and diff text. Then after making another pass for the final review, he applies them in a single batch. I tend to work more incrementally. My "first pass" is to read mails and fire off kibitzing responses without doing anything other than marking potentially worthy patches for later review. My second pass is actually applying the patch by piping each e-mail message from my e-mail client to "git am -3 -s", and if I do not like something in the patch, I make corrections and then run "git commit --amend". My final pass is "git log -p", and if I find something I want to fix, I do "git format-patch -$N" and "git reset --hard HEAD~$N", fix it up in the editor by editing the commit message and the diff text, and "git am" to rebind the branch. In short, there are two different approaches: - If a fix is something trivial, and if you are comfortable editing diff text in your editor, then edit it before applying. - If a fix is more involved, you are probably better off stopping immediately after applying the patch you want to fix up, make the fix in your working tree, and commit it with "git commit --amend". - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html