Git Command Cheat Sheet Restore a deleted file This grabs the last version of a file and restores it git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"