Created
June 23, 2013 18:01
-
-
Save grauwoelfchen/5845924 to your computer and use it in GitHub Desktop.
Displays behind/ahead like GitHub's Branches view :)
This file contains hidden or 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
function st-branch() { | |
local branch remote ahead behind | |
if [[ -n $1 ]]; then | |
remote=$1 | |
else | |
remote="upstrm" | |
fi | |
git for-each-ref --format="%(refname:short)" refs/heads refs/remotes | \ | |
while read branch | |
do | |
ahead=`git rev-list remotes/"${remote}"/master..${branch} --count 2>/dev/null` | |
behind=`git rev-list ${branch}..remotes/"${remote}"/master --count 2>/dev/null` | |
printf "%-30s %16s | %-15s %s\n" "$branch" "(behind $behind)" "(ahead $ahead)" "remotes/${remote}/master" | |
done | |
} |
Author
grauwoelfchen
commented
Jun 23, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment