Searching

Searching for Content

git grep regexp
Search working tree for text matching regular expression regexp.
git grep -e regexp1 [--or] -e regexp2
Search working tree for lines of text matching regular expression regexp1 or regexp2.
git grep -e regexp1 --and -e regexp2
Search working tree for lines of text matching regular expression regexp1 and regexp2, reporting file paths only.
git grep -l --all-match -e regexp1 -e regexp2
Search working tree for files that have lines of text matching regular expression regexp1 and lines of text matching regular expression regexp2.
git grep regexp $(git rev-list --all)
Search all revisions for text matching regular expression regexp.
git grep regexp $(git rev-list rev1..rev2)
Search all revisions between rev1 and rev2 for text matching regular expression regexp.

Searching Logs and Commit History

git log --grep regexp
Search commit logs for lines of text matching regular expression regexp.
git log --grep regexp1 --grep regexp2
Search commit logs for lines of text matching regular expression regexp1 or regexp2.
git log --grep regexp1 --and --grep regexp2
Search commit logs for lines of text matching regular expression regexp1 and regexp2.