Turns out the relevant variable is actually grep-find-template . This takes a command with a few additional parameters:

<D> for the base directory

for the base directory <X> for the find options to restrict directory list

for the find options to restrict directory list <F> for the find options to limit the files matched

for the find options to limit the files matched <C> for the place to put -i if the search is case-insensitive

for the place to put if the search is case-insensitive <R> for the regular expression to search for

The default template looks like this:

find . <X> -type f <F> -exec grep <C> -nH -e <R> {} +

To make the command work with git grep , I had to pass in a few options to make sure git doesn't use a pager and outputs things in the right format. I also ignored a few of the template options because git grep already restricts the files searched in a natural way. However, it probably makes sense to add them back in somehow.

My new value for grep-find-template is

git --no-pager grep --no-color --line-number <C> <R>

After some cursory testing, it seems to work.

Note that you should set this variable using grep-apply-setting rather than modifying it directly:

(grep-apply-setting 'grep-find-template "git --no-pager grep --no-color --line-number <C> <R>")

Since I don't use two of the inputs to rgrep , I wrote my own git-grep command which temporarily stashes the old grep-find-template and replaces it with mine. This feels a bit hacky, but also seems to work.