0 votes
1 view
in Devops and Agile by (22k points)

We have several annotated tags in our git repository. The older tags have bogus messages that we would like to update to be in our new style.

% git tag -n1

v1.0 message

v1.1 message

v1.2 message

v2.0 Version 2.0 built on 22 July 2019.

In this example, we would like to make v1.x messages look like the v2.0 message. Does anyone know how we would do this?

1 Answer

0 votes
by (37.6k points)

To create a new tag with the same name and by overriding the original you could use:

git tag <tag name> <tag name>^{} -f -m "<new message>"

Reference: https://git-scm.com/docs/git-tag#Documentation/git-tag.txt---edit 

The documentation clearly says that:

The message is taken from file with -F and command line with -m are usually used as the tag message unmodified. This option lets you further edit the message taken from these sources.