Find and view a file deleted from the alternate account


I'm working on a project in git, and I know that at some time in the past (long before I had the code) there existed a file called exec.js. I want to view the contents of this file. I know which repository used to contain this file, but I don't know the exact path.

You could use wildcard characters in git log:

git log -- *exec.js

will give you all log messages when any file called exec.js was modified.

Once you find the deleting commit (say A), you could

git checkout A -- *exec.js

This will bring you the last version of exec.js.

If you want to view the full history of exec.js, you could use gitk:

gitk -- *exec.js

This will show you all the modifications again. If you're particularly interested in one commit, you could right click the file in the gitk dialog and then select external diff tool. This will open the external diff tool with the full files, not only the patches.