gitgit-am

git am should ignore something in commit message startswith "[]"?


I have a commit with message like [Hello World]Something.
Then I use git format-patch HEAD~1 to crate a patch.
Content of patch like this:

Subject: [PATCH 1/7] [Hello World] Something.

But after I use git am to apply patch,the commit message became "Something" only,[Hello World] seems lost.
How can I keep content in "[]" after apply patch?


Solution

  • git am -k would prevent it from removing content in [] brackets at the beginning of the subject, but that would also keep the [PATCH 1/7] portion. git format-patch also has a -k option which would prevent it from adding that type of content allowing the subject to be preserved through a git format-patch | git am cycle.