Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
find file in any git revision
#!/usr/bin/env bash
PHRASE=$1;
for rev in $(git rev-list --all); do
if [ -n "`( git ls-tree --full-tree -r $rev; ) | grep $PHRASE`" ]; then
echo "`git branch --contains $rev | grep '*' | tr -d [:space:] | tr -d [=*=];`:$rev:`git ls-tree --full-tree -r $rev | grep $PHRASE`";
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment