Skip to content

Instantly share code, notes, and snippets.

@tedgrubb
Last active August 29, 2015 14:01
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 tedgrubb/4a4052ed6fe9129e4667 to your computer and use it in GitHub Desktop.
Save tedgrubb/4a4052ed6fe9129e4667 to your computer and use it in GitHub Desktop.
Bash script to recommend a code reviewer based on the files you changed.
function git-assign() {
changed_files=$(git diff --name-only HEAD master)
authors=$(echo "$changed_files" | xargs -L1 git log --follow | grep Author:)
printf "Authors in order of commits made to these files:\n\n"
printf "$changed_files\n\n"
printf "$authors" | sort | uniq -c | sort -r | sed 's/Author:/Commits:/g'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment