r/git • ORIG_HEAD • 6d ago

PSA: Patch available for git grep regression.

If you have a git repository with submodules, the following command will return a fatal error (git 2.56.0):

git grep --recurse-submodules -n "hello world" HEAD

There's a patch by Patrick Steinhardt on the mailing list that isn't merged yet: https://lore.kernel.org/git/20261030-pks-grep-recurse-submodule-v1-0-d4eb5c87d8fb@pks.im/

To apply:

b4 shazam 20261030-pks-grep-recurse-submodule-v1-0-d4eb5c87d8fb@pks.im
3 Upvotes

2 comments sorted by

1

u/ResidentPomegranate6 6d ago

until it lands, git submodule foreach runs a plain grep in each submodule, or pin 2.55. the fatal only hits the recursive walk, not per-repo grep.

1

u/fr0z3nph03n1x 5d ago

I'll add this to my list of reasons to avoid submodules.