git restoring single deleted file

Backup your git repo first!

Easily recover a git-tracked file, even after several commits have passed

myfile=path/to/myfile.txt

git checkout $(git rev-list -n 1 HEAD -- "$myfile")^ -- "$myfile"

Categories:

Updated: