heading: 'Git Tag Snippets' title: 'Git Tag Snippets' description: 'Git Tags' date: '2023-07-18' icon: 'Git' draft: false summary: 'Git Tags' tags: ['git'] layout: 'Snippet'
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>