Skip to content

Instantly share code, notes, and snippets.

@infusion
Created May 22, 2016 22:23
Show Gist options
  • Select an option

  • Save infusion/b2cfefbea3fd0f601eec9755c69a7b66 to your computer and use it in GitHub Desktop.

Select an option

Save infusion/b2cfefbea3fd0f601eec9755c69a7b66 to your computer and use it in GitHub Desktop.

Revisions

  1. infusion created this gist May 22, 2016.
    6 changes: 6 additions & 0 deletions git-restore-file.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@

    # Find last commit for the deleted file
    git rev-list -n 1 HEAD -- $path

    # Checkout the commit before the the delete happened
    git checkout $commit^ -- $path