Git Tag Snippets

Git Tags Snippets

🏷️ View all tags:

git tag

🏷️ View the state of a repo at a particular tag:

git checkout <tagname>

🏷️ Creating a lightweight tag:

git tag <tagname>

🏷️ Associate tag to a branch:

git tag <tagname> <branchname>

🏷️ Create an annotated tag (used for releases):

git tag -a <tagname> -m "message" <commithash>

🏷️ Tag an older commit by providing the commit hash:

git tag <tagname> <commithash>

🏷️ Forcefully update a tag (use with caution!):

git tag -f <tagname>

🏷️ Delete a tag:

git tag -d <tagname>

🏷️ Push tags to remote server:

git push --tags

🏷️ Push deleted tags to the remote server:

git push origin :<deleted-tag-name>