Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: Is an unannotated tag worse than a tag with a bad annotation?

Tags:

git

tags

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 somewhat 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?

like image 265
Debilski Avatar asked Feb 18 '10 15:02

Debilski


People also ask

What is the difference between annotated and unannotated tags?

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.

What is the difference between lightweight and annotated tags?

Git supports two types of tags: lightweight and annotated. A lightweight tag is very much like a branch that doesn't change — it's just a pointer to a specific commit. Annotated tags, however, are stored as full objects in the Git database.

What is annotated tag in git?

Annotated tags are stored as full objects in the Git database. To reiterate, They store extra meta data such as: the tagger name, email, and date. Similar to commits and commit messages Annotated tags have a tagging message.

How do I create a lightweight tag in git?

To create a lightweight tag, all you need to provide is a tag name. You don't need to include any of the flags you would see with annotated tags (see below). If we run git show on this tag, we simply see the commit hash, the author, the date, and the commit message.


1 Answers

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.

like image 170
Dustin Avatar answered Oct 21 '22 00:10

Dustin