TL;DR
The difference between the commands is that one provides you with a tag message while the other doesn't. An annotated tag has a message that can be displayed with git-show(1), while a tag without annotations is just a named pointer to a commit.
More About Lightweight Tags
According to the documentation: "To create a lightweight tag, don't supply any of the -a, -s, or -m options, just provide a tag name". There are also some different options to write a message on annotated tags:
- When you use
git tag <tagname>
, Git will create a tag at the current revision but will not prompt you for an annotation. It will be tagged without a message (this is a lightweight tag). - When you use
git tag -a <tagname>
, Git will prompt you for an annotation unless you have also used the -m flag to provide a message. - When you use
git tag -a -m <msg> <tagname>
, Git will tag the commit and annotate it with the provided message. - When you use
git tag -m <msg> <tagname>
, Git will behave as if you passed the -a flag for annotation and use the provided message.
Basically, it just amounts to whether you want the tag to have an annotation and some other information associated with it or not.
No comments:
Post a Comment