Created
November 14, 2017 07:06
-
-
Save czue/4152fd5717fe72b89d68979167cdd017 to your computer and use it in GitHub Desktop.
A little bash script for git blaming things matching git grep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# usage: ./git_grep_blame.sh todo | |
# HT: https://stackoverflow.com/a/43664756/8207 | |
if [ "$1" = "" ] ; then | |
echo "usage: $0 <term>" 1>&2 | |
exit 1 | |
fi | |
for file in $(git grep -i $1 | cut -d ':' -f 1 | uniq) ; do | |
echo $file :: | |
git blame $file | grep $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment