Created
May 26, 2011 14:31
-
-
Save andyscott/993267 to your computer and use it in GitHub Desktop.
WIP script for determining which repos are ahead/behind origin
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/sh | |
dg="\e[0;32m" | |
r="\e[1;31m" | |
b="\e[1;34m" | |
m="\e[1;35m" | |
cyan="\e[1;36m" | |
rs="\e[0m" | |
pdir=${PWD##*/} | |
echo -e "$cyan$pdir$rs" | |
echo " branch status delta" | |
for ref in $(git for-each-ref --format='%(refname:short)' refs/heads/); do | |
uref=${ref}'@{upstream}' | |
! git rev-parse --verify --quiet "$uref" >/dev/null 2>&1 && { | |
printf "$b%10s$dg local\n" $ref | |
continue | |
} | |
ahead=`git rev-list "$uref..$ref" | wc -l` | |
test $ahead -gt 0 && { | |
printf "$b%10s$dg ahead $rs+$ahead\n" $ref | |
continue | |
} | |
behind=`git rev-list "$ref..$uref" | wc -l` | |
test $behind -gt 0 && { | |
printf "$b%10s$dg behind $r-$behind\n" $ref | |
} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment