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 <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

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM