Merge pull request #222 from sinbad/feature/fix_default_behaviour
Fix init -d behaviour when master branch exists, and 1+ other branches exist, but develop does not
diff --git a/git-flow-init b/git-flow-init
index 4afa1c2..00646fe 100644
--- a/git-flow-init
+++ b/git-flow-init
@@ -153,11 +153,17 @@
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] "