Created
February 27, 2020 18:23
-
-
Save kerembaydogan/a5eda9f24f90b6876a8a3fe7270090ac to your computer and use it in GitHub Desktop.
Git Bring Back Deleted Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## run this line | |
## find the file you are searching for | |
## note output ex: 'delete mode 100755 folder1/folder2/deletedFile.xml' | |
git log --diff-filter=D --summary | grep delete | |
## run this line | |
## note output ex: 'a0f533730f4255b0c8f36d9f2594b4aed5e772ce' | |
git rev-list -n 1 HEAD -- folder1/folder2/deletedFile.xml | |
## run this line using output of the previous command | |
## DO NOT DELETE '~1' CHARACTERS | |
git checkout a0f533730f4255b0c8f36d9f2594b4aed5e772ce~1 -- folder1/folder2/deletedFile.xml | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment