[Git] Restrict git grep to files with a particular extension

Created on November 30, 2026

You can pass a pathspec after -- to restrict the files that git grep searches. This example looks for report in PHP files. The quotes let Git interpret the wildcard.

git grep 'report' -- '*.php'
Git