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

git checkout does not warn about tags without corresponding commits

From
Henrik Austad <henrik@austad.us>
Date
Jan 2, 2009, 12:25 UTC
Message-ID
<200901021325.58049.henrik@austad.us>
Hi!

I recently tried to do a checkout of (what I thought was the first) inux kernel in the linux git repo.

git checkout -b 2.6.11 v2.6.11

This tag exists in the linux-tree (direct clone from Linus' tree), along with v2.6.11-tree

However, when I inspect the log, I see that I am still stuck in master. So, I did a git tag -v v2.6.11 and got the following:

object c39ae07f393806ccf406ef966e9a15afc43cc36a type tree tag v2.6.11-tree

This is the 2.6.11 tree object.

NOTE! There's no commit for this, since it happened before I started with git. Eventually we'll import some sort of history, and that should tie this tree object up to a real commit. In the meantime, this acts as an anchor point for doing diffs etc under git. gpg: Signature made Thu 05 May 2005 01:50:54 AM CEST using DSA key ID 76E21CBB gpg: Good signature from "Linus Torvalds (tag signing key) <torvalds@osdl.org>" gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: FF6D 4EAC 37AC C1B9 53AE C7E8 1776 2C46 76E2 1CBB

I can see that there's no commit for this, but, when there's a tag. I thought that a tag was just a commit-sha1 with a name attached, along with some tag info and a signature. Can you really create a tag without a commit?

Shouldn't git checkout fail in some way, letting me know that the checkout did not check out what I thought it did? (I got aware of the bug when I found CFS-related code in something I thought was 2.6.11.. :-)

-- 
 -> henrik
Next: Miklos Vajna
Message 1 of 8 in “git checkout does not warn about tags without corresponding commits”
  1. Henrik AustadJan 2, 2009
  2. Miklos VajnaJan 2, 2009
  3. Junio C HamanoJan 2, 2009
  4. Henrik AustadJan 3, 2009
  5. Junio C HamanoJan 3, 2009
  6. Junio C HamanoJan 3, 2009
  7. Henrik AustadJan 3, 2009
  8. Daniel BarkalowJan 3, 2009

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.