Versioning is easy to do with git tags. There are two different types of tags, annotated and lightweight tags.

1. Create a new tag

Annotated tags have extra metadata like author name, release notes, etc. These are important for your project’s public release. you can create an “annotated tag” with -a and this is like commit message.

$ git tag -a <tagname> 
*<tagname> will be v1.0.0

You can add a tag message with -m option

$ git tag -a v1.0.0 -m "New version v1.0.0"

Lightweight tags have only the hash of the commit and don’t have information.

$ git tag <tagname>
*<tagname> will be v1.0.0

2. Push tag

For a single tag

$ git push origin <tagname>

For all tags at once

$ git push origin --tags

3. See all tag lists

$ git tag

Happy coding! 🙂

Resources

  1. https://git-scm.com/docs/git-tag
  2. https://www.atlassian.com/git/tutorials/inspecting-a-repository/git-tag
  3. https://dev.to/neshaz/a-tutorial-for-tagging-releases-in-git-147e
  4. https://blog.daftcode.pl/how-to-become-a-master-of-git-tags-b70fbd9609d9
Author

Write A Comment