Original URL: http://blog.csdn.net/iaiti/article/details/39557951
It's been a long time, GitHub commit, I preface a local file to delete, and then always git pull found unable to recover. This file is still available in the remote library. Is that I want to return the remote library's files to a location that was deleted locally.
In particular, after I add a file on the GitHub website, the pull will update the file locally.
But the local file that I received deleted is not recovered anyway.
Online check, in fact, only a real mention of the use of checkout file, the rest are directly copied, even a reprint will not be explained.
Do:
F:\mygithub\javaprogram\util [Master +0 ~0-1]> git Checkout
D Util/testtimer.java
Next you just need:
git checkout Testtimer.java
Above is your current directory is in the util inside or will
Error:pathspec ' Testtimer.java ' did not match any file (s) known to Git.
Remember to add a specific path
I thought that when this step was resolved, we found that the file was still not recovered.
It may be because I deleted it and submitted it again.
Later in the forum found a git reset--hard HEAD will commit the reset.
Finally, using git checkout Testtimer.java to recover.
If the files in the folder are deleted,
Then only git checkout util (folder name) is required.
If you don't want to toss that much, it's a good choice to clone directly.
"Go" GitHub issue to recover locally deleted files