Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to annotate an existing tag in git

Tags:

git

I created a tag but didn't use -m option, so my tag is not associated with a message (is not annotated). How can I add a message to this already created tag?

like image 200
Denio Mariz Avatar asked Feb 22 '17 11:02

Denio Mariz


People also ask

How do I annotate a tag in git?

It will be tagged without a message (this is a lightweight tag). When you use git tag -a <tagname> , Git will prompt you for an annotation unless you have also used the -m flag to provide a message. When you use git tag -a -m <msg> <tagname> , Git will tag the commit and annotate it with the provided message.

Can we update tag in github?

Similar to this, sometimes, we are required to update the tags in Git. Updating a tag will take your tag to another commit. For example, we can update the tag v1. 1 to another commit depicting that the stable Version1.

Which command is used to create an annotated tag?

To create a Git tag with a message, use the “git tag” command with the “-a” option for “annotated” and the “-m” option for message.


1 Answers

As described in this question, you can override a tag with the force option. (-f or --force).

Create a tag with the same name as the tag you want to override, add your -m option, and add the force option.

If the tag is for an earlier commit, you can supply the hash of the commit the tag is for as an argument to the git tag-command, as described in the git docs.

like image 166
madsroskar Avatar answered Nov 14 '22 08:11

madsroskar