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