Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include newline characters in git tag messages

Tags:

git

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?

like image 777
Eric Peterson Avatar asked May 21 '12 17:05

Eric Peterson


1 Answers

Assuming you're using a unix shell, your syntax for newline is wrong.

git tag -a v1.0.0 -m "* Change number 1
* Change number 2"

should work.

like image 124
Max Nanasy Avatar answered Oct 25 '22 19:10

Max Nanasy