Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k 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 (50.2k 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. 

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...