The Problem

Recently I lost a file in the Git orcus (aka './git/objects').
I knew it had been there some time ago.
But now it was gone and the Git on-board tools ('rev-list', 'fsck', ...) didn't help.
They showed a lot of dangling commits, trees and blobs but not the file I was searching for.

The Solution (maybe not the best)

I was doomed to dive into the .git/object-slough.
Based on a shell script on stackoverflow.com
from willkil
I created a small Perl script:

It has one command line argument: the file to search for (as a regex).

In the first phase it looks into each tree object and checks whether it contains the file.

In the second phase it looks into each commit object and checks whether it points to one of the tree objects found in phase 1.

At last it creates a branch ('found/0', 'found/1', ...) for each commit found in phase 2.