gitgrep

How to exclude certain directories/files from a Git grep search


Is there a way to exclude certain paths/directories/files when searching a Git repository using git grep? Something similar to the --exclude option in the normal grep command?

I need to use git grep because using grep directly runs too slowly on large Git repositories.


Solution

  • It is not possible in older versions of Git, but it was discussed. A proposed workaround is in the link:

    You can put *.dll to .gitignore file then git grep --exclude-standard.

    See also onlynone's answer, since Git 1.9.0 it's possible.