Skip to content

Instantly share code, notes, and snippets.

@HokieGeek
Last active May 23, 2017 15:10
Show Gist options
  • Save HokieGeek/b4d0899057a2303c3338b797fc07cd46 to your computer and use it in GitHub Desktop.
Save HokieGeek/b4d0899057a2303c3338b797fc07cd46 to your computer and use it in GitHub Desktop.
Recursive git grep for my old version of git at work
#!/bin/sh
${cmd:="git --no-pager grep "$@}
[ "`readlink --canonicalize $PWD`" == "`git rev-parse --show-toplevel`" ] && \
git submodule --quiet foreach --recursive \
"${cmd} | awk -v path=\$path '{ print path, \$0 }' OFS='/' || :"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment