Skip to content

Instantly share code, notes, and snippets.

@markhuge
Forked from lonnen/gist:3101795
Created February 17, 2022 07:22
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 markhuge/64d6f5094763e2a759dac489a9b3aeb5 to your computer and use it in GitHub Desktop.
Save markhuge/64d6f5094763e2a759dac489a9b3aeb5 to your computer and use it in GitHub Desktop.
git grep and git blame. two great tastes that taste great together
# from i8ramin - http://getintothis.com/blog/2012/04/02/git-grep-and-blame-bash-function/
# runs git grep on a pattern, and then uses git blame to who did it
ggb() {
git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
# small modification for git egrep bash
geb() {
git grep -E -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment