Skip to content

Instantly share code, notes, and snippets.

@hotchpotch
Created November 29, 2010 07:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hotchpotch/719705 to your computer and use it in GitHub Desktop.
Save hotchpotch/719705 to your computer and use it in GitHub Desktop.
#!/bin/bash
git --no-pager grep "$@"
git --no-pager submodule --quiet foreach 'git grep --full-name -n ' "$@" '; true'
@ryan-williams
Copy link

with git 2.11.0 I see this error:

/usr/local/Cellar/git/2.11.0/libexec/git-core/git-submodule: line 337: git grep --full-name -n : command not found

all ears if anyone has a work-around

@ryan-williams
Copy link

git ls-files --recurse-submodules | xargs grep "$@"

seems to work.

git 2.12.0 (out any day now) will support --recurse-submodules flag (h/t SO).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment