Last active
December 12, 2015 01:18
-
-
Save mcharytoniuk/4690149 to your computer and use it in GitHub Desktop.
find file in any git revision
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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