Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to use tags in Git

📅 2017-Oct-04 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ git, tag ⬩ 📚 Archive

A tag in Git is a user-friendly label attached to a particular commit. It is commonly used to mark a particular commit, for example to mark as a release version. Using tags in Git is quite easy, once you notice how they are pushed to a remote repository.

$ git tag
$ git checkout -b FOOBAR_BRANCH FOOBAR_TAG
$ git tag FOOBAR_TAG
$ git tag FOOBAR_TAG abcd1234
$ git log -n 1 FOOBAR_TAG
$ git rev-list -n 1 FOOBAR_TAG
$ git push FOOBAR_REMOTE --tags
$ git tag -f FOOBAR_TAG
$ git push -f FOOBAR_REMOTE --tags

Tried with: Git 2.7.4 and Ubuntu 16.04

© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 Mastodon📧 Email