Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git-remote-authors
#!/bin/bash
# git-remote-authors
#
# Print recent commit info for all remote branches.
#
# Place this script in your PATH, chmod +x it, and git will allow you to magically do:
# $ git remote-authors (num_commits_to_lookback)
#
# Author: devops@appnexus.com
# Last modified: 3 February 2014
if [[ -z "$1" ]]
then
num_commits=5
else
num_commits=$1
fi
FORMAT='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
LOG_PARAMS=("--pretty=format:$FORMAT" "--abbrev-commit" "--date=relative" "-n $num_commits")
PRINT_BREAK=0
for b in $(git branch -r | grep -v HEAD | awk '{print $1}'); do
output=$(git log "${LOG_PARAMS[@]}" $b)
if [[ $PRINT_BREAK -eq 1 ]]
then
echo
else
PRINT_BREAK=1
fi
echo "Branch: $b"
echo "$output"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.