From 60507001e8ae2148ffab63963d7a7dd4751b75f6 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Wed, 10 Jul 2024 16:42:17 +0300 Subject: [PATCH] Add support of custom base branch name for 'git release' --- .zshrc | 6 ++++-- install.sh | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.zshrc b/.zshrc index f6df109..b8269ac 100644 --- a/.zshrc +++ b/.zshrc @@ -227,12 +227,14 @@ function git_release() { return 0 fi - if [[ $(\git rev-parse --abbrev-ref HEAD 2>/dev/null) != "master" ]] ; then + local defBranch=$(\git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') + + if [[ $(\git rev-parse --abbrev-ref HEAD 2>/dev/null) != "$defBranch" ]] ; then if ! \git push ; then return 1 fi - if ! \git checkout master ; then + if ! \git checkout "$defBranch" ; then return 1 fi fi diff --git a/install.sh b/install.sh index 10b6466..d639ad9 100755 --- a/install.sh +++ b/install.sh @@ -7,7 +7,7 @@ set -e ################################################################################ -VERSION="2.4.6" +VERSION="2.4.7" ################################################################################