User Tools

Site Tools


software:git:tag

Tagging

Tags allow marking a particular point on the history of the code.

Create a tag

It should be preferred to use annotated tags because they are independent objects, with their own description message (instead of referencing the message of a commit).

To create a tag after the last commit:

git tag -a <tag-name> -m '<tag-message>'

Eventually, it's also possible to tag an old commit:

git tag -a <tag-name> <hash-old-commit> -m '<tag-message>'

Push a tag

To push a specific tag on a remote repository:

git push origin <tag-name>

List tags

To list all the tags present in the local repository:

git tag

Then it's possible to inspect on particular tag:

git show <tag-name>

Delete a tag

To delete a specific tag:

git tag -d <tag-name>

Then it's necessary to push the change to the remote repository:

git push origin --delete <tag-name>

Replace an existing tag

In case it's necessary to change only the description message associated to a specific tag:

git tag -a <tag-name> -f -m <tag-message>

For a full descriptive list of all options:

git help tag
software/git/tag.txt · Last modified: 2023/05/28 16:37 by 127.0.0.1