Last active
January 4, 2016 00:59
-
-
Save jhuttner/8545698 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# git-recent | |
# | |
# Call 'git fetch' and log all remote branches that have any activity | |
# in the past n days (default=3). | |
# | |
# Place this script in your PATH, chmod +x it, and git will allow you to magically do: | |
# $ git recent (days) | |
# | |
# Note: in order for this to work you must name the file "git-recent" without | |
# an extension. | |
# | |
# Author: devops@appnexus.com | |
# Last modified: 21 January 2014 | |
if [[ -z "$1" ]] | |
then | |
days=3 | |
else | |
days=$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" "--since=$days.days") | |
git fetch | |
PRINT_BREAK=0 | |
for b in $(git branch -r | grep -v HEAD | awk '{print $1}'); do | |
output=$(git log "${LOG_PARAMS[@]}" $b) | |
if [[ -n $output ]] | |
then | |
if [[ $PRINT_BREAK -eq 1 ]] | |
then | |
echo | |
else | |
PRINT_BREAK=1 | |
fi | |
echo "Branch: $b" | |
echo "$output" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment