"Go" GitHub issue to recover locally deleted files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.