gpt4 book ai didi

Git checkout 无分支提交

转载 作者:行者123 更新时间:2023-12-05 06:06:31 24 4
gpt4 key购买 nike

我已将 GitHub 存储库克隆到我的本地计算机上。 我希望本地存储库的状态能够反射(reflect)其在特定提交时的状态,所以我的直觉是 git checkout <commit> .但是,这样做会导致错误:

fatal: reference is not a tree: 7aa823a959e1f50c0dab9e01c1940235eccc04cc

查看 GitHub 上的提交会产生以下警告:

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

我有哪些选择?如果有帮助,GitHub 存储库是 Linux kernel source tree并且有问题的提交是 7aa823a959e1f50c0dab9e01c1940235eccc04cc .

最佳答案

显然,能够在 GitHub 网络界面上查看提交并不一定意味着该提交存在于存储库中(因此出现警告)。我能够使用 git cat-file -t <commit> 确认我的存储库不包含有问题的提交对象.

因此,我能够通过在 GitHub 上搜索包含我需要的提交的合适分支来解决我的问题。

感谢torekElpieKay感谢他们在评论中的帮助。

关于Git checkout 无分支提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65728429/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com