Skip to content

Instantly share code, notes, and snippets.

@nhashmi
Created November 22, 2016 16:50
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 nhashmi/5e491e093438ef66a9b0d1bba7f10c10 to your computer and use it in GitHub Desktop.
Save nhashmi/5e491e093438ef66a9b0d1bba7f10c10 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
BASE_BRANCH="develop"
suggest_reviewers() {
echo '*Suggested Reviewers*\n--------------------'
collect_file_names | blame_files
}
collect_file_names() {
git diff --name-only HEAD $BASE_BRANCH
}
blame_files() {
xargs -L 1 git blame --line-porcelain | count_lines
}
count_lines() {
sed -n 's/^author //p' | authors_of_most_lines
}
authors_of_most_lines() {
sort | uniq -c | sort -rn | head -3
}
suggest_reviewers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment