git-grep Command Examples

Find strings inside files anywhere in a repository's history. Accepts a lot of the same flags as regular grep. More information: https://git-scm.com/docs/git-grep.

git grep {{search_string}}

git grep {{search_string}} -- {{file_glob_pattern}}

git grep --recurse-submodules {{search_string}}

git grep {{search_string}} {{HEAD~2}}

git grep {{search_string}} $(git rev-list --all)