HOWTO: restore a deleted file in git

less than 1 minute read

$ git rev-list -n 1 HEAD -- path_to_file  #this gives you the commit's hash  
$ git checkout commit_hash^ -- path_to_file # it restores the file

Tags: ,

Categories: ,

Updated:

Leave a Comment