GIT结帐标记问题 - 分离的HEAD状态

时间:2018-02-23 18:20:02

标签: git unix git-detached-head

此项目的目的是调用不在标准UNIX路径中的代码。

我的教授提供了从GIT存储库克隆gawk的步骤,然后以autoconf格式构建和安装。

我的问题是 - 从git://git.savannah.gnu.org/gawk.git克隆后我需要更改我要安装的版本。当我使用教授为我们提供的git checkout标签/ gawk-3.1.8命令时,我收到以下输出。 当我使用make和make install命令时,我最终得到的是最新版本的gawk而不是3.1.8。

Note: checking out 'tags/gawk-3.1.8'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by perfoming another checkout.
If you want to create a new branch to retain commits you create, you may do
so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at 00ef042... Move to 3.1.8

我搜索了几个独立的HEAD州论坛,但未能找到解决方案。任何帮助表示赞赏。

2 个答案:

答案 0 :(得分:1)

这不是错误,一切都按预期工作。请注意输出如何显示Note:而不是Error:或其他内容。

该注释只是告诉您处于"detached HEAD"状态,如果您只是使用回购并且不打算推送任何提交,那就没问题了。

答案 1 :(得分:0)

你分离的HEAD状态不一定是"问题"你需要解决的问题。我知道打印的警告可能会让你感到惊恐,但只是Git试图阻止你犯错误。

分离的HEAD只意味着您的HEAD引用不指向除提交之外的任何其他引用。

换句话说:你不在分支机构。这不是一个需要解决的问题,您应该能够像您一样检查该版本,并根据您教授提供的说明构建项目。

在此处阅读更多内容:https://git-scm.com/docs/git-checkout#_detached_head

相关问题