Search code examples
gitformat-patchgit-am

git am is choking characters from my commit messages


I'm using some private annotations in my git commit messages.

For example, when I fixed something in module MOD_A, the commit message looks like this:

FIX [MOD_A] Fixed something

As long as there's FIX in front of [MOD_A], everything works fine if I generate a patch using

git format-patch

send this patch as attachment to somewhere and then use

git am --keep-cr *.patch

in order to store this commit in another repo.

But: If I don't have FIX in front of [MOD_A] (i.e. [MOD_A] Fixed something), the start of the message is missing in the other repo after doing git am. The whole commit message is only Fixed something.

My suspicion is that it has something to do with the format of the Subject line of the E-Mail generated by git format-patch:

Subject: [PATCH 23/27] [MOD_A] Fixed something

It seems like because the [PATCH 23/27] is enclosed in squared brackets, also [MOD_A] is ignored.

Is there a way to have my [MOD_A] not ignored?


Solution

  • if you can live without [PATCH x/x] automatically added to subject line, you could do git format-patch -k and then git am -k ...

    i assume just pushing your patches to another repo is not an option