-
-
Save msankhala/c2bad869836160d4d67da86b598cdc72 to your computer and use it in GitHub Desktop.
Find and restore a deleted file in a Git
This file contains hidden or 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
# Find last commit for the deleted file | |
git rev-list -n 1 HEAD -- $path | |
# Checkout the commit before the the delete happened | |
git checkout $commit^ -- $path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment