我今天读了很多与此问题相关的帖子(这里有一篇有用的帖子:修复 Git 分离头? https://stackoverflow.com/questions/10228760/how-to-fix-a-git-detached-head & 为什么我的 Git 存储库进入分离 HEAD 状态? https://stackoverflow.com/questions/3965676/why-did-git-detach-my-head).
今天我一直在挠头。即使在阅读了这些文章后,我也无法理解如何解决这个问题。
昨天一切都很好,我记得已经发出了结账命令。晚上我发现即使存在本地更改,Git 也没有显示任何更改。经过今天的研究,我现在可以看到 git status 显示“HEAD detached from 99f040f”。
从那时起,我删除了 D:(在我的 Windows 7 上)中的 .git 文件夹,并恢复了 7 月 27 日备份的 .git。还是没有解决。我也尝试过7月25日的版本。但没有运气。所以我现在恢复了昨天的 .git 版本。
I'm pasting the screenshot from gitk. Is there anything I can do to correct this issue?
要返回到最后签出的分支,只需输入
git checkout -
似乎有点记录不足(搜索You may also specify
在文档中git checkout https://www.kernel.org/pub/software/scm/git/docs/git-checkout.html),但对我有用。
也可以用作在两个分支之间切换的便捷快捷方式:
git checkout master
git checkout branchwithaverylongnamethatyoudontwanttotypeagain
git checkout - # brings back master
git checkout - # brings back branchwithaverylongnamethatyoudontwanttotypeagain
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)