Skip to content

Instantly share code, notes, and snippets.

@jhuttner
Last active August 29, 2015 13:56
Show Gist options
  • Save jhuttner/8795653 to your computer and use it in GitHub Desktop.
Save jhuttner/8795653 to your computer and use it in GitHub Desktop.
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: [email protected]
# 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