Reputation: 96521
A while back in a known branch i committed a file, which was subsequently removed. Many iterations later, i'd like to recover this file.
How can this be done please?
Upvotes: 1
Views: 83
Reputation: 62499
If you remember the file name, you can just run git log -- <filename>
to show all commits that involved that file. If you don't remember the file name, but remember something about the contents, you can use git log -S <string>
or git log -G <regex>
to search for it.
Upvotes: 3
Reputation: 191
git log -U | less
find the most recent commit that referenced the filename
git checkout MOST-RECENT-COMMIT FILENAME
Upvotes: 0