From 17279c846cd8c12fa2e5db0b88914d58dbb47e35 Mon Sep 17 00:00:00 2001 From: Michael Allen Date: Mon, 16 Feb 2015 16:45:09 +0000 Subject: functions to get the commit difference between the branch on the remote and the master --- git-base.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'git-base.sh') diff --git a/git-base.sh b/git-base.sh index 9ffda78..951ec58 100755 --- a/git-base.sh +++ b/git-base.sh @@ -150,3 +150,29 @@ commits_ahead_of_remote() { echo "0" fi } + +remote_behind_of_master() { + if is_tracking_remote; then + set -- + set -- $(git rev-list --left-right --count origin/master...$(remote_branch_name)) + behind=$1 + ahead=$2 + set -- + echo $behind + else + echo "0" + fi +} + +remote_ahead_of_master() { + if is_tracking_remote; then + set -- + set -- $(git rev-list --left-right --count origin/master...$(remote_branch_name)) + behind=$1 + ahead=$2 + set -- + echo $ahead + else + echo "0" + fi +} -- cgit v1.2.3