Skip to content

Instantly share code, notes, and snippets.

@mcharytoniuk
Last active December 12, 2015 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcharytoniuk/4690149 to your computer and use it in GitHub Desktop.
Save mcharytoniuk/4690149 to your computer and use it in GitHub Desktop.
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