git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-am and workflow question

From
KGKumar Gala <galak@kernel.crashing.org>
Date
Feb 8, 2007, 16:07 UTC
Message-ID
<9A55745B-03D2-47B3-8359-FF2D9575502E@kernel.crashing.org>
In-Reply-To
<7vodo5153j.fsf@assigned-by-dhcp.cox.net>
On Feb 8, 2007, at 1:27 AM, Junio C Hamano wrote:
Show 46 quoted lines
> Kumar Gala <galak@kernel.crashing.org> 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".

Thanks. Have there been any thoughts on having git-am apply the patch and then let the user do some modifications before the commit? I kinda did this by hand by doing the following:

git-am -i ... < suspend > patch -p1 < .dotest/patch < modify > git-diff > .dotest/patch < cleanup > < resume >

- k
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 7 in “git-am and workflow question”
  1. Kumar GalaFeb 8, 2007
  2. Junio C HamanoFeb 8, 2007
  3. Kumar GalaFeb 8, 2007
  4. Junio C HamanoFeb 8, 2007
  5. Michael S. TsirkinFeb 10, 2007
  6. Junio C HamanoFeb 11, 2007
  7. Jakub NarebskiFeb 8, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.