develop_branch uses origin/develop_branch as start-point if one exists.
By default a local develop branch is created of from master regardless if a origin/develop exits. This problem is discussed in issues #137 and #23.
diff --git a/git-flow-init b/git-flow-init
index 57ab244..d19b651 100644
--- a/git-flow-init
+++ b/git-flow-init
@@ -200,7 +200,11 @@
# default production branch and develop was "created". We should create
# the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$develop_branch"; then
- git branch --no-track "$develop_branch" "$master_branch"
+ if git_remote_branch_exists "origin/$develop_branch"; then
+ git branch "$develop_branch" "origin/$develop_branch" >/dev/null 2>&1
+ else
+ git branch --no-track "$develop_branch" "$master_branch"
+ fi
created_gitflow_branch=1
fi