Skip to content

Instantly share code, notes, and snippets.

@chrismarksus
Created April 17, 2015 15:44
Show Gist options
  • Save chrismarksus/7d4257e81a8512492c98 to your computer and use it in GitHub Desktop.
Save chrismarksus/7d4257e81a8512492c98 to your computer and use it in GitHub Desktop.
bash function for getting the total commit for a user on a branch for a project
your_total_commits_on_branch_and_project() {
total=$(git log --author="$1" --pretty=oneline --no-merges | wc -l)
branch=$(git rev-parse --abbrev-ref HEAD)
project=$(git remote -v | head -n1 | sed -e 's/^[a-z]*.[http|ftp|ssh]*\:\/\/[a-Z]*\///' | sed -e 's/ ([fetch]*)//')
echo -e "\033[1;32m$1\033[0;32m has \033[1;32m$total\033[0;32m commits, on branch \033[1;32m$branch\033[0;32m, for project \033[1;32m$project\033[0m"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment