Chris G.
Chris G.

Reputation: 25964

git pull - how to un-delete local files

How to un-delete / recover local files from git pull?

Scenario:

  1. I have local files in a folder
  2. I do git init
  3. "git pull https://.." from server
  4. All the local files is deleted

Can I get my deleted files back?

Thanks

Upvotes: 2

Views: 758

Answers (1)

user4815162342
user4815162342

Reputation: 154906

If the lost files were never staged or committed, there is no way to restore them using git. At this point, the only thing you can do is try to restore them using third-party undeletion utilities written for your OS.

(In my tests git doesn't delete local files at a git pull, but at this point how the files got deleted is not relevant to the question, only to git's reputation for not deleting user data.)

Upvotes: 1

Related Questions