Reputation: 67127
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?
Upvotes: 4
Views: 393
Reputation: 446
With git as version '1.8.4' (perhaps before) you can also use: git am --keep-non-patch
. It passes the -b
flag to git mailinfo
:
-b
When -k is not in effect, all leading strings bracketed with [ and ] pairs are stripped. This option limits the stripping to only the pairs whose bracketed string contains the word "PATCH".
Emanuele
Upvotes: 5
Reputation: 2080
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
Upvotes: 5