git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [QUESTION] What is a tag for?

From
Junio C Hamano <junkio@cox.net>
Date
Jan 18, 2006, 01:41 UTC
Message-ID
<7v1wz648jc.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<1137538344.9104.34.camel@malory>
Alex Bennee <kernel-hacker@bennee.com> writes:
> ... I'm not brave enough to sit on the very bleeding edge and
> build what ever happens to be at the "HEAD" of the tree. However when a
> kernel releases I'd like to build *that* kernel.

Then maybe its time to change your e-mail address from kernel-hacker to kernel-builder? ;-) ;-) ;-)

> I keep thinking of tags like labels in the old convetional SCM case. Is
> this correct?
Correct.

Tags are just labels. So you can think of them as a shorthand that lets you easily communicate a set of selected well-known versions with others (either people, or git tools). Instead of saying 2664b25051f7ab96b22b199aa2f..., you can say v2.6.16-rc1.

All of the things I demonstrate below, you can substitute v2.6.X with their commit object names and things work the same way. It is more convenient and human friendly to use tags.

Except one thing: signed tags can be verified, if you have GPG public key of the signer (in this case Linus), with "git verify-tag".

<offtopic> Does anybody know where to obtain the public key to verify v2.6.16-rc1 tag? </offtopic>

> So what do I do with them now? Are they only for branch points?

That is one of the things often done. To build on top of v2.6.16-rc1:

	$ git checkout -b myhack v2.6.16-rc1
	$ hack hack hack
        $ git commit -s -m 'Add support for frotz videocard.
	This adds frotz videocard support.  Blah Blah Blah...'

You could also use them to see what happened during a given timeframe. For example:

	$ git log v2.6.14..v2.6.15 | git shortlog

would list you all the changes between these two releases, for example.

If you know something used to work at a given version, say v2.6.15, and now it does not work, you can use it as good/bad input for the bisection bug hunting:

	$ git bisect good v2.6.15 && git bisect bad master
> Is the
> only way to know I'm building 2.6.16-rc1 to branch from it as described
> in git-branch, even if I'm not planning on doing any development?

I do not quite understand. Immediately after the above example checkout, before or after doing the hackhack and commit, git branch would probably say:

	$ git branch
          origin
	  master
        * myhack

Immediately after the example checkout, "git describe myhack" would answer v2.6.16-rc1. OTOH, after the hackhack and commit, it would answer v2.6.16-rc1-gXXXXXXXX where XXXX part is an abbreviated commit object name of the commit you have at the tip of myhack branch.

To see what you did in the branch, the tag, if you remember where you forked from, can be used this way:

	$ git whatchanged -p v2.6.16-rc1..myhack
However, the above is equivalent to saying this:
	$ git whatchanged -p master..myhack

So in that sense tag is not that useful for the purpose of getting list of commits (or, more precicely, naming a development track).

It is useful to name a specific version:
	$ git diff v2.6.16-rc1 myhack
compares two versions; it is not equivalent to "git diff master myhack".
> Is this part of the concept that branches are cheap and you should feel
> free to create and throw them away at will?

That depends on what you exactly mean by "this", but all of the above are quite cheap. If the "myhack" practice turned out to be useless, you can just:

	$ git checkout master
        $ git branch -D myhack
to come back to the tip of the mainline and delete your side branch.
Previous: Petr BaudisNext: Linus Torvalds
Message 3 of 12 in “[QUESTION] What is a tag for?”
  1. Alex BenneeJan 17, 2006
  2. Petr BaudisJan 17, 2006
  3. Junio C HamanoJan 18, 2006
  4. Linus TorvaldsJan 18, 2006
  5. Junio C HamanoJan 18, 2006
  6. Petr BaudisJan 18, 2006
  7. Petr BaudisJan 18, 2006
  8. Andreas EricssonJan 18, 2006
  9. Junio C HamanoJan 18, 2006
  10. Andreas EricssonJan 18, 2006
  11. Junio C HamanoJan 25, 2006
  12. Andreas EricssonJan 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.