Skip to content

Instantly share code, notes, and snippets.

@strathmeyer
Created September 14, 2017 06:02
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 strathmeyer/7e4a80059ce85636cafe64fe99166a34 to your computer and use it in GitHub Desktop.
Save strathmeyer/7e4a80059ce85636cafe64fe99166a34 to your computer and use it in GitHub Desktop.
Blames TODOs in Python files
GIT_GREP="$(git grep -i -n -E '#[ ]*TODO' -- '*.py')"
IFS=$'\n' read -rd '' -a LINES <<<"$GIT_GREP"
for LINE in "${LINES[@]}"
do
IFS=: read FILE LINE MATCH <<<"$LINE"
echo "$FILE:$LINE"
git blame $FILE -L $LINE,+1
echo
done
@strathmeyer
Copy link
Author

If you want to run it in subdirectories, add the --full-name option to the GIT_GREP command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment