Search code examples
gitgit-commitgit-tag

Difference between tag and commit message


I understand one always needs a message for committing the changes but when and why do I need to also tag a commit? Let's say I made some changes and I commit using

git add -A
git commit -m "add feature 1"

and now

git tag -a -m "includes feature 1" v0.1

The question is when does this make sense.


Solution

  • It would make sense to specify a tag when you release a version of the software you're producing.

    You could then do:

    git tag -a v1.0 -m "Release Version 1.0"

    Like my comment mentioned, you do not have to tag after every commit, like you mention in your post, you can also create lightweight tags, if you don't want to include a message. This would look like:

    git tag v1.0

    Hope this helps.