Don't stop the script when the release branch is the current branch.
Simply step aside to the master branch instead.
diff --git a/git-flow-release b/git-flow-release
index 521a9d8..2b3684f 100644
--- a/git-flow-release
+++ b/git-flow-release
@@ -149,12 +149,6 @@
die "There is an existing release branch ($first_branch). Finish that one first."
}
-require_not_on_release_branch() {
- if [ "$BRANCH" = "$(git_current_branch)"]; then
- die "You cannot be in the '$BRANCH' branch when you finish it."
- fi
-}
-
cmd_start() {
DEFINE_boolean fetch false "fetch from $ORIGIN before performing finish" F
parse_args "$@"
@@ -210,7 +204,6 @@
# sanity checks
require_branch "$BRANCH"
require_clean_working_tree
- require_not_on_release_branch
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
@@ -264,6 +257,9 @@
# delete branch
if noflag keep; then
+ if [ "$BRANCH" = "$(git_current_branch)" ]; then
+ git checkout "$MASTER_BRANCH"
+ fi
git branch -d "$BRANCH"
fi