Skip to content

Instantly share code, notes, and snippets.

@ryanfb
Last active December 27, 2015 02:59
Show Gist options
  • Select an option

  • Save ryanfb/7256217 to your computer and use it in GitHub Desktop.

Select an option

Save ryanfb/7256217 to your computer and use it in GitHub Desktop.
Search all branches of all git repositories in a directory. ./network_grep.sh parentdir pattern [path]
#!/bin/bash
for i in $(find $1 -type d -name '.git')
do echo $i
git --git-dir=$i --no-pager grep $2 $(git --git-dir=$i rev-list --all) -- $3
done
#!/bin/bash
for i in $(find $1 -type d -name '.git')
do echo $i
git --git-dir=$i --no-pager log -S$2 -- $3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment