Git: Display the content of a deleted file

Sometimes, for some reason, you want to see the content of a file that you already deleted (and commited) but you don’t want to recover it.

To do that you will need two things :

  1. The last commit where the file was still there
  2. The full path of this file

and then you’ll just need to execute this cmd

git show commitID:path/to/the/file

PS: You can also get the full list of the files that you deleted in the working tree using this command

git log –diff-filter=D –summary

Leave a Reply