A useful command to search contents within a Git repository is git grep:
$ git grep <pattern>
Example
For example, to see the files and lines where text is foo
:
$ git grep foo
To also see line numbers:
$ git grep -n foo
To see only the files:
$ git grep -l foo
To search within commit reference(s):
$ git grep foo my_branch
$ git grep foo HEAD~3
$ git grep foo abc1234 def5678
To search with regex:
$ git grep -e "^foo"
$ git grep -e foo --or bar
$ git grep -e "^foo" --and -e "bar$"