gpt4 book ai didi

Git:恢复到以前的提交状态

转载 作者:IT王子 更新时间:2023-10-29 01:11:08 26 4
gpt4 key购买 nike

我很困惑。我想回到我在“git log”中确定的之前的提交。

但是当我执行“git checkout”时,我并没有被告知要提交。没有什么变化。它告诉我我处于分离的 HEAD 模式,但我想要的文件不在那里。

我到底做错了什么?

B先生

最佳答案

git reset --hard <commit>从联机帮助页:

Matches the working tree and index to that of the tree being switched to. Any changes to tracked files in the working tree since are lost.

git checkout用于将您的工作目录切换到不同的分支或提交。这不会移动 HEAD那里。

关于Git:恢复到以前的提交状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5004237/

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