Is it possible to run git grep inside all the branches of a Git control sourced project? Or is there another command to run?
I found this most useful:
git grep -i foo `git for-each-ref --format='%(refname)' refs/`
You'd need to adjust the last arguments depending on whether you want to only look at remote vs. local branches, i.e.:
git grep -i foo $(git for-each-ref --format='%(refname)' refs/remotes)git grep -i foo $(git for-each-ref --format='%(refname)' refs/heads)The alias I created looks like this:
grep-refs = !sh -c 'git grep "$0" "$@" "$(git for-each-ref --format=\"%(refname)\"" refs/)'