Skip to content

Instantly share code, notes, and snippets.

@rmondello
Forked from tangphillip/contributions.sh
Created August 15, 2012 05:53
Show Gist options
  • Save rmondello/3356625 to your computer and use it in GitHub Desktop.
Save rmondello/3356625 to your computer and use it in GitHub Desktop.
Find your contributions to a git repo, by file
# A regex that matches your commit name. Escape colons, if you use any.
NAME="(Phil(lip)? Tang|[email protected])"
# Find all plaintext files. Warning: Can be slow with moderate or large repos
FILES=(`find . -type f -exec sh -c "file {} | grep text >/dev/null" \; -print`)
# Find files with extension ".coffee" or ".sass"
FILES=(`find . -name "*.coffee" -o -name "*.sass"`)
for FILE in ${FILES[@]}
do
git blame $FILE | cut -f 2 -d "(" | cut -f 1,2 -d " " | tr -d "(" | sort | uniq -c | grep -E "$NAME" | sed -E "s:$NAME:$FILE:"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment