How to include newline characters in git tag messages
git
Solution
The closest solution I found is to use multiple `-m` options, one for each line. For example:
git tag -a v1.0.0 -m "* Change number 1" -m "* Change number 2"
from git-tag man page:
-m <msg>
Use the given tag message (instead of prompting). If multiple
-m options are given, their values are concatenated as separate
paragraphs. (...)
UPDATE: Check "Add line break to git commit -m from command line" for more shell-based solutions.
Problem
When I tag versioned code in git, I like using bullet points in the tag message. This can easily be done with annotated tags: ``` git tag -a v1.0.0 * Change number 1 * Change number 2 # # Write a tag message # ``` However, if I attempt the same tag with the -m option, the tag message is not what I expect: ``` git tag -a v1.0.0 -m "* Change number 1\n* Change number 2" git show v1.0.0 ... * Change number 1\n* Change number 2 .... ``` The '\n' was interpreted literally as the characters '\' and 'n' instead of a newline. I want to use the `-m` option so that I can automate the tagging process. Is there any way to include actual newline characters using `git tag` with the `-m` option?