0

A few days ago I had the need to recover a file deleted in a prior commit and was unable to find a way to do it. Anyone able to suggest how? Also any of the nice gui git tools provides OOB this capability?

whatever
  • 2,492
  • 6
  • 30
  • 42
  • Had to navigate a few questions but yes it does. Here is the answer I liked most https://stackoverflow.com/a/7203551/5014665 – whatever Mar 06 '20 at 20:38

1 Answers1

2

You can checkout the file from the previous revision from where you deleted it. So, say the revision where it was deleted is rev some-rev:

git checkout some-rev~:path-to-file

That will leave the file on index ready to be committed.

eftshift0
  • 26,375
  • 3
  • 36
  • 60