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


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

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