To search the content of commits, as opposed to the metadata like the commit message, run this:

$ git grep REGEX $(git rev-list --all)

To search the commit messages, run that:

$ git log --all --grep REGEX