Regexp search Git repo history and output the file contents.

git grep <regexp> $(git rev-list --all)

or

git rev-list --all | xargs git grep "regexp"

if previous line gives you ‘Argument list too long’
To show file contents.

git show <SHA> -- <path-to-file>

credits go to SO.

Leave a Reply

Your email address will not be published. Required fields are marked *