Recover files deleted in git

Recover Files Deleted From Drive But Not Committed Yet

If you removed a version file from your computer's harddrive but did not yet commit the changes you can recover the files with the following command

#Syntax: Recover
#git checkout HEAD -- FILE_OR_FOLDER_NAME

#restore a deleted folder
git checkout HEAD -- sites/all/modules/contrib/mymodule

#restore a deleted file
git checkout HEAD -- sites/a.txt

 

Cookbook Category: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.