Skip to content

Instantly share code, notes, and snippets.

@mity
Created March 26, 2018 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mity/528fd972d36dd5d4c24a68be62c4c1f9 to your computer and use it in GitHub Desktop.
Save mity/528fd972d36dd5d4c24a68be62c4c1f9 to your computer and use it in GitHub Desktop.
Grepping over all git repos found anywhere in the subtree of current working directory.
#!/bin/bash
#
# Grepping over all git repos found anywhere in the subtree of current working
# directory.
#
find . -type d -name .git | while read line; do
repo=`dirname "$line"`
( cd "$repo" && git grep -n "$@" | sed "s|^|$repo/|" )
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment