Git:恢复到之前的提交状态 [英] Git: Revert to previous commit status
问题描述
但是当我做git checkout时,我没有说commit。没有什么变化。
它告诉我我处于独立HEAD模式,但我想要的文件不在那里。
我做错了什么?
MrB
匹配正在切换的树的工作树和索引。
git checkout
用于将您的工作目录切换到不同的分支或提交。这不会移动 HEAD
那里。
I'm confused. I want to go back to a previous commit that I identified in "git log".
But when I do "git checkout ", I don't get said commit. Nothing changes. It tells me I'm in detached HEAD mode, but the files I want are not there.
What the eff am I doing wrong?
MrB
git reset --hard <commit>
From the manpage:
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
is for switching your working directory to a different branch or commit. This does not move the HEAD
there.
这篇关于Git:恢复到之前的提交状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!