Skip to content

Instantly share code, notes, and snippets.

@christoomey
Created December 30, 2010 20:21
Show Gist options
  • Save christoomey/760246 to your computer and use it in GitHub Desktop.
Save christoomey/760246 to your computer and use it in GitHub Desktop.
Have git output the contents of a deleted file from the commit before it was deleted
function git_show_deleted_file {
# Rev-list command gets commit that deleted the file, ^ gets prior commit
git show $(git rev-list -n 1 HEAD -- $1)^:$1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment