Skip to content

Commit 6d9d538

Browse files
kd35abill-auger
authored andcommitted
Adds a status-line if everything is synchronized
1 parent f702f9a commit 6d9d538

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

git-branch-status

100644100755
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@
77
# dns_check (ahead 1) | (behind 112) origin/master
88
# master (ahead 2) | (behind 0) origin/master
99

10+
tot_diff=0
11+
1012
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
1113
while read local remote
1214
do
1315
[ -z "$remote" ] && continue
1416
git rev-list --left-right ${local}...${remote} -- 2>/dev/null >/tmp/git_upstream_status_delta || continue
1517
LEFT_AHEAD=$(grep -c '^<' /tmp/git_upstream_status_delta)
1618
RIGHT_AHEAD=$(grep -c '^>' /tmp/git_upstream_status_delta)
19+
tot_diff=$LEFT_AHEAD+$RIGHT_AHEAD+$tot_diff
1720
echo "$local (ahead $LEFT_AHEAD) | (behind $RIGHT_AHEAD) $remote"
18-
done
21+
done
22+
23+
if [ "$tot_diff" == "0" ]; then
24+
echo "Everything is synchronized."
25+
fi

0 commit comments

Comments
 (0)