java - git上面,工作目录怎么恢复到上次提交的版本
大家讲道理
大家讲道理 2017-04-17 17:55:05
0
4
473

所有命令都还没有push。
由于在编辑某文件的过程中不小心做了改动,然后点了保存,还没有commit。
想要利用git恢复成尚未改动时的样子。
下面是问题描述:
我在git上创建了一个名为“428”的分支,也知道上一次提交的版本。
下面是各分支的情况

试过了下面的命令了

git checkout -- 

但是本地目录中的文件还是未恢复,应该怎么操作?

补充:虚拟环境目录下的文件夹也会随着git命令改动吗?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(4)
左手右手慢动作

git reset --hard <commmit hash>

左手右手慢动作

To restore a single file, use git checkout [previously submitted commit id] -- file name. If you want to discard all files in the workspace, use git reset --hard <commit id>

阿神

git reset HEAD^
Revert the last commit, so that the commit is rolled back and the changes will be retained in the uncommitted state

大家讲道理

git checkout -- You need to specify the file name later.
If you want to undo all the uncommitted changes in your working directory, you can use git stash. This is to temporarily undo the changes and save them if you no longer need to restore them. , git stash drop will never recover.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!