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

Re: [Bug report] git format-patch + git am doesn't preserve original commit message

From
Jeff King <peff@peff.net>
Date
Jun 10, 2021, 16:29 UTC
Message-ID
<YMI99TBbZ1zCFE1V@coredump.intra.peff.net>
In-Reply-To
<CAMJzOtx9D7KthsUi7eLcmz7rszOQh8t=-VhXeOGDX1CMV1iERQ@mail.gmail.com>
On Thu, Jun 10, 2021 at 05:36:43PM +0200, Nikita Bobko wrote:
Show 6 quoted lines
> Oh, I see, thank you, it works.
> 
> But actually, I am not sure that it's "expected" behavior. I would
> expect git to preserve original message by default without any
> additional flags. Shouldn't `--keep-non-patch` flag in `git am` be
> enabled by default then?

I'd be hesitant to change that, since it would break any communities using other tags. I think 17635fc900 (mailinfo: -b option keeps [bracketed] strings that is not a [PATCH] marker, 2009-07-15) has some examples.

In your example, I think passing "-k" to both git-format-patch and git-am is the right solution. But presumably that's a toy example. In the real world, the person running "am" is probably not the same as the one running format-patch (and if it is, probably something like cherry-pick is a better solution anyway).

-Peff
Previous: Nikita Bobko
Message 4 of 4 in “[Bug report] git format-patch + git am doesn't preserve original commit message”
  1. Nikita BobkoJun 10, 2021
  2. Jeff KingJun 10, 2021
  3. Nikita BobkoJun 10, 2021
  4. Jeff KingJun 10, 2021

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.