Skip to content

Instantly share code, notes, and snippets.

@ricardogarfe
Created December 30, 2015 07:11
Show Gist options
  • Save ricardogarfe/9c2336b5dea924b61ff6 to your computer and use it in GitHub Desktop.
Save ricardogarfe/9c2336b5dea924b61ff6 to your computer and use it in GitHub Desktop.

This should show a list of commits in all branches which touched that file. Then, you can find the version of the file you want, and display it with...

git log --all -- <path-to-file>
git show <SHA> -- <path-to-file>

Get a list of the deleted files and copy the full path of the deleted file

git log --diff-filter=D --summary -- <path-to-file> | grep delete

Execute the next command to find commit id of that commit and copy the commit id

git log --all -- FILEPATH

Show diff of deleted file

git show COMMIT_ID -- FILE_PATH

Remember, you can write output to a file using > like

git show COMMIT_ID -- FILE_PATH > deleted.diff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment