本文介绍了Git:恢复到之前的提交状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



但是当我做git checkout时,我没有说commit。没有什么变化。
它告诉我我处于独立HEAD模式,但我想要的文件不在那里。



我做错了什么?



MrB

解决方案 重置--hard< ; commit> 从手册页:

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:

git checkout is for switching your working directory to a different branch or commit. This does not move the HEAD there.

这篇关于Git:恢复到之前的提交状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 19:52