๐ Edit page
โ Add page
git-grep
How to use gitโs search tool
Help
$ git grep --help
git-grep - Print lines matching a pattern
...
Resources
- git-grep Documentation
- Git - Searching tutorial.
Examples
Looks for time_t
in all tracked .c
and .h
files in the working directory and its subdirectories.
$ git grep 'time_t' -- '*.[ch]'
Looks for a line that has #define and either MAX_PATH or PATH_MAX.
$ git grep -e '#define' --and \( -e MAX_PATH -e PATH_MAX \)
Looks for a line that has NODE or Unexpected in files that have lines that match both.
git grep --all-match -e NODE -e Unexpected
Looks for solution, excluding files in Documentation.
$ git grep solution -- :^Documentation