From c4fb3687ba6742858248df664d62213977eb5f34 Mon Sep 17 00:00:00 2001 From: Guillaume MOCQUET Date: Tue, 15 Jun 2021 16:39:34 +0200 Subject: [PATCH] feat(git-branch-linearity): add support to main or master target branch --- git-branch-linearity.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/git-branch-linearity.sh b/git-branch-linearity.sh index ca0eac7..9a7164f 100755 --- a/git-branch-linearity.sh +++ b/git-branch-linearity.sh @@ -1,5 +1,9 @@ #!/bin/sh -out=$(git log origin/master..HEAD --merges --oneline) + +if [ "$(git branch --list main)" ]; then TARGET_BRANCH="main"; else TARGET_BRANCH="master"; fi + +echo "Target branch: $TARGET_BRANCH" +out=$(git log origin/${TARGET_BRANCH}..HEAD --merges --oneline) exit_status=$? if [ -n "$out" ]