Phil for Humanity Phil for Humanity
A Guide for the Survival of Humankind and Helping the World, Society, and Yourself.

Git Tag

Tagging in Git can be very useful to quickly label a certain release or lockdown a known instance of files. For instance, to tag the current state of an entire repository, you can use this command:


The message is optional and customizable, but I strongly recommend using it. The tag name must be unique, so I recommend incrementing a version number. You can view existing tag names, so you do not try re-use an existing tag name, with this command:

git tag -l

This command even accepts wildcards to help narrow down your tag list.

git tag l *WORD*

Back to tagging, to overwrite or force re-using an existing tag name, use this command:

git tag f TAG

You can even tag a SHA or specific version, like this:

git tag TAG SHA

git tag TAG HEAD~~

To delete a tag, you can use this command:

git tag d TAG

You can directly go back to an existing tag by using this command:

git checkout TAG

Finally, to push tags to the remote repository, a regular push is not sufficient. You have to specifically push the tags like this:

git push --tags

Thats it. You are now a Git tagging expert.

by Phil for Humanity
on 11/06/2012

Related Articles
 » Git Log and Cat-File
 » Git Error when Creating a Branch
 » Git Changes