Git 从旧标签签出分支

Git checkout branch from old tag

我正在尝试从 linux kernel git project 中的旧标签签出新分支。

我可以结帐v2.6.13就好了:

$ git checkout -b build-2.6.13 v2.6.13

但是当我尝试从标签 v2.6.11 创建一个分支时,我得到这个错误:

$ git checkout -b build-2.6.11 v2.6.11
fatal: Cannot switch branch to a non-commit 'v2.6.11'

我也尝试过使用 refs/tags/v2.6.11tags/v2.6.11 作为标签引用,两者 return 同样的错误。

我想知道为什么从此标签创建分支失败。

这个标签points to a tree object, not a commit 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.

我不确定 "import some sort of history" 这一步是否是您作为最终用户可以执行的操作。如果是,我不知道怎么办。

link to the tagged tree 似乎也无效:

Invalid commit reference: c39ae07f393806ccf406ef966e9a15afc43cc36a

这可不是什么好兆头。不幸的是,答案可能是您将无法追踪此版本的 Linux 源代码。