Reputation: 5093
As I get an editor (vi) when doing a git commit -m
I'd like to get an editor doing
git tag myTagName -m
as my comment will contain code with quotes and I'd like to avoid escaping it!
Upvotes: 7
Views: 1789
Reputation: 48288
When tagging, give the parameter -a
so git can see that this tag is "annotated", then git will open your editor to input the text.
For example:
git tag -a v1.0
Upvotes: 10
Reputation: 26166
From the Git documentation:
If one of
-a
,-s
, or-u <keyid>
is passed, the command creates a tag object, and requires a tag message. Unless-m <msg>
or-F <file>
is given, an editor is started for the user to type in the tag message.If
-m <msg>
or-F <file>
is given and-a
,-s
, and-u <keyid>
are absent,-a
is implied.Otherwise, a tag reference that points directly at the given object (i.e., a lightweight tag) is created.
As you may know, there are several kinds of tags in Git. When you used -m <msg>
, you were implying -a
(annotated tag). If you want to see the editor to provide the message, while still creating an annotated tag, simply use -a
instead.
Upvotes: 4