form1.cn
Make a little progress every day

git找回本地误删的文件

14th of August 2018 Linux GIT 2266

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


想从仓库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 <file>..." 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