Search git commit history with grep

When you want to search the actual commit contents in git from the command line for a regular expression i.e. text you need to find

  • git rev-list --all: Search the entire git commit history
  • xargs: Sends the arguments to the results of the previous expression

Bash

git rev-list --all | xargs git grep <regular expression>

Batch/PowerShell
git rev-list --all | git grep <regular expression>