File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # by http://github.com/jehiah
3+ # this prints out some branch status (similar to the '... ahead' info you get from git status)
4+
5+ # example:
6+ # $ git branch-status
7+ # dns_check (ahead 1) | (behind 112) origin/master
8+ # master (ahead 2) | (behind 0) origin/master
9+
10+ git for-each-ref --format=" %(refname:short) %(upstream:short)" refs/heads | \
11+ while read local remote
12+ do
13+ [ -z " $remote " ] && continue
14+ git rev-list --left-right ${local} ...${remote} -- 2> /dev/null > /tmp/git_upstream_status_delta || continue
15+ LEFT_AHEAD=$( grep -c ' ^<' /tmp/git_upstream_status_delta)
16+ RIGHT_AHEAD=$( grep -c ' ^>' /tmp/git_upstream_status_delta)
17+ echo " $local (ahead $LEFT_AHEAD ) | (behind $RIGHT_AHEAD ) $remote "
18+ done
You can’t perform that action at this time.
0 commit comments