git,找回本地误删文件

不小心把本地的文件删除了一个?

想从仓库git pull 下拉?

对不起,这是不行的,虽然不知道为什么,但是我告诉你怎么回复这个文件。

首先,我们先用git status 看看工作区的变化

$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.
Changes to be committed:
(use "git reset HEAD ..." to unstage)

    deleted:    Application/Home/View/Index/Index.html

Application/Home/View/Index/Index.html 记住这个
工作区告诉我,你把这个文件删除了,那么接下来是这样的

一,执行命令:

$ git reset HEAD Application/Home/View/Index/Index.html(注释:上面的那个路径)
Unstaged changes after reset:
D Application/Home/View/Index/Index.html
二,执行:

git checkout Application/Home/View/Index/Index.html

好啦,你误删的文件回来了

转载:https://blog.csdn.net/qq_32384249/article/details/73038413
如有侵权,请及时联系删除

原文地址:https://www.cnblogs.com/uzi666/p/13850050.html