Git tip: [prefix] in commit messages
When you use git format-patch and git send-email to format and mail a patch, the subject line of the email becomes
[PATCH] first line of commit message
Since patches go through a mailing list, mailman adds a prefix of its own:
[Koha-patches] [PATCH] first line of commit message
When the patch is applied, git am invokes git mailinfo to clean up the subject line, including whitespace, “Re:”, and any leading sets of text in square brackets. However, it can be a little too greedy.
If your original commit message starts with
[bug 1234] add automatic whale-saving,
the patch will reach me with the subject line
[Koha-patches] [PATCH] [bug 1234] add automatic whale-saving.
However, git am (as of 1.5.5, at any rate) will chomp it down to
add automatic whale-saving.
Oops! No bug number to immortalize your rescue of cetaceans via an ILS!
To avoid that, try bug 1234: ..., (bug 1234) ..., or if you really like square brackets, move it to the end: ... [bug 1234].
Tags: Git

December 3rd, 2008 at 10:04 am
Great tip, Galen. I didn’t realize that.
You can also use some convenient options to git-format-patch to adjust the subjects. For instance, you can use the “–numbered” flag to add numbers to each patch in a set. For instance, it may say [PATCH 3/4]. Or, you can use “–subject-prefix=” to adjust the word “PATCH”. For instance, perhaps it would help to use “–subject-prefix=PATCH ver 2″ on sets of patches that replace an earlier set of patches that haven’t been applied yet. Or, perhaps “RFC” is a good way to indicate that these patches should not be put into Koha but are looking for additional community feedback.
There’s a lot to learn about git!