From 26327787c75249ca684af39bc111a5f4847ae01e Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Tue, 5 Jun 2012 16:26:10 -0700 Subject: [PATCH] Fix init -d behaviour when master branch exists, and one or more other branch exists, but develop does not Without this change, init picks 'master' as both the production and integration branch and fails. With it, init detects the clash and behaves the same as if only master exists, picking 'develop' as integration branch --- git-flow-init | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/git-flow-init b/git-flow-init index 4afa1c25e..00646fed7 100644 --- a/git-flow-init +++ b/git-flow-init @@ -153,11 +153,17 @@ cmd_default() { default_suggestion= for guess in $(git config --get gitflow.branch.develop) \ 'develop' 'int' 'integration' 'master'; do - if git_local_branch_exists "$guess"; then + if git_local_branch_exists "$guess" && [ "$guess" != "$master_branch" ]; then default_suggestion="$guess" break fi done + + if [ -z $default_suggestion ]; then + should_check_existence=NO + default_suggestion=$(git config --get gitflow.branch.develop || echo develop) + fi + fi printf "Branch name for \"next release\" development: [$default_suggestion] "