Now you want this file back which you've deleted a while ago.
1. Get the id of the commit where the file was deleted using one of the ways below.
- git log --grep=word
- git log -Sword
- git log | grep --context=5 word
- git log --stat | grep --context=5 word # recommended if you hardly remember anything
2. You should get something like:
commit bfe68bd117e1091c96d2976c99b3bcc8310bebe7Author: Alexander Orlov <firstname.lastname@example.org>Date: Thu May 12 23:44:27 2011 +02003. Now using the commit id bfe68bd117e1091c96d2976c99b3bcc8310bebe7 do:
replaced deprecated GWT class - gwtI18nKeySync.sh, an outdated (?, replaced by a Maven goal) I18n generation script
commit 3ea4e3af253ac6fd1691ff6bb89c964f54802302Author: Alexander Orlov <email@example.com>Date: Thu May 12 22:10:22 2011 +0200
git checkout bfe68bd117e1091c96d2976c99b3bcc8310bebe7^1 yourFile.java
As the commit id references the commit where the file was already deleted you need to reference the commit just before bfe68b which you can do by appending ^1. This means: give me the commit just before bfe68b.