git: Is an unannotated tag worse than a tag with a bad annotation?
Every git tutorial you look into has a clear opinion about tags: One should always use annotated tags, one of the reasons being that they are used by git describe
.
However, I don’t see anything bad in using git describe --tags
which also takes the unannotated tags as a reference point. Is there anything else that’s considered bad about unannotated tags?
I’m asking because I’ve just finished converting a SVN project to git. I was actually thinking about providing the tags with an annotation but what should I’ve put there if not an alarmingly redundant ‘Tagging release 1.5 for our project’ message (which had been used as an SVN comment already anyway)?
Annotated tags seem like a nice thing to me (you can tag things as a different author and might give a short description), but should you really use them even in cases when you don’t have anything meaningful to say apart from the original commit message?
or
In which situations are unannotated tags not frowned upon?
Edit: I’m not talking about signed annotated tags (I understand the advantage of having signed tags in some situations); I’m only concerned about the difference between unannotated and unsigned annotated.
Edit 2: Appending another question to broaden the scope somewh开发者_Go百科at and maybe get some insightful answers about the real-life best-bractices
When do you use unannotated tags and do you feel bad about it when you do?
An annotated tag is actually a tag object. It has an author, a description, a timestamp and points to a commit.
A lightweight tag points to a commit and contains no other information. It's got more in common with branching than with tagging.
man git-tag
says:
Annotated tags are meant for release while lightweight tags are meant for private or temporary object labels.
So basically don't push lightweight tags.
When you consider this, all behavior design choices make sense:
annotated tags can contain a message, creator, and date different than the commit they point to. So you could use them to describe a release without making a release commit.
Lightweight tags don't have that extra information, and don't need it, since you are only going to use it yourself to develop.
git push --follow-tags will only push annotated tags, so as to not publish your local tags.
git describe
answers the question: "what release does this commit belong to?", which is a common use case.
See also:
- What is the difference between an annotated and unannotated tag?
- In what circumstances should I add the -a flag to the git tag command?
精彩评论