Re: git-am applies commit message diffs
On Fri, Feb 6, 2026, at 08:43, Matthias Beyer wrote:
Show 22 quoted lines
> Hi,
>
> I am not sure whether this was already reported, searching the lore did
> not yield anything for me, but I might have overlooked it...
>
> This was just posted on mastodon[0]:
>
> PSA: Did you know that it’s **unsafe** to put code diffs into your
> commit messages?
>
> Like https://
> github.com/i3/i3/pull/6564 for example
>
> Such diffs will be applied by patch(1) (also git-am(1)) as part of
> the code change!
>
> This is how a sleep(1) made it into i3 4.25-2 in Debian unstable.
>
> TL;DR: If you put a diff in the commit message, that diff will be
> applied by git-am.
>
> This looks clearly like unintended and might be an attack-vector, right?
I have an idea for a proposal to note this in the documentation.