From 39eca41c30ea0da2a64022556e584ccb6f1a31e1 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Wed, 19 Jun 2019 13:03:04 +0100 Subject: [PATCH] Adds git-branch-summary script --- bin/git/git-branch-summary | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 bin/git/git-branch-summary diff --git a/bin/git/git-branch-summary b/bin/git/git-branch-summary new file mode 100755 index 00000000..056f197b --- /dev/null +++ b/bin/git/git-branch-summary @@ -0,0 +1,24 @@ +#!/bin/bash + +mainBranch="${1-master}" + + +for branch in $(git branch -a); do + + if [ "$branch" = "$mainBranch" ]; then + continue; + fi + + masterInFront=$(git log --oneline "$branch".."$mainBranch" | wc -l) + branchInFront=$(git log --oneline "$mainBranch".."$branch" | wc -l) + + if [ "$masterInFront" = "0" ] && [ "$branchInFront" = "0" ]; then + echo "$mainBranch and $branch are in sync" + else + echo "$mainBranch is $masterInFront commits in front of $branch" + echo "$branch is $branchInFront commits in front of $mainBranch" + fi + + echo "" + +done