Added implementation of git-flow-init that asks the user interactively what
branches should be used for master and develop and then initializes the Git
repo itself and/or the git-flow branches for him or her.
diff --git a/git-flow-init b/git-flow-init
index 4c43b31..c38dab6 100644
--- a/git-flow-init
+++ b/git-flow-init
@@ -18,57 +18,100 @@
 
 # Default entry when no SUBACTION is given
 cmd_default() {
-	echo
-	echo "Summary of actions:"
-
 	if ! git rev-parse --git-dir >/dev/null 2>&1; then
-		git init --quiet
-		echo "- A new git repository at $PWD was created"
+		git init
+	else
+		echo "Will try to incorporate git-flow into your current repo."
 	fi
 
-	if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
-		touch "$README"
-		git add "$README"
-		git commit --quiet -m "initial commit"
-		if [ "$MASTER_BRANCH" != "master" ]; then
-			git branch -m master "$MASTER_BRANCH"
+	local branch_count
+
+	# add a master branch if no such branch exists yet
+	local master_branch
+	if ! git config --get gitflow.branch.master >/dev/null; then
+
+		# first, ask how to create the master branch
+		echo
+		echo "Which branch should be used for bringing forth production releases?"
+		branch_count=$(gitflow_all_branches | wc -l)
+		if [ "$branch_count" -gt 0 ]; then
+			gitflow_all_branches | sed 's/^.*$/   - &/g'
+			echo "You may use an existing branch name, or specify a new one."
 		fi
-		echo "- An initial commit was created at branch '$MASTER_BRANCH'"
+		echo "Branch name for production releases: [master] \c"
+		read master_branch
+
+		master_branch=${master_branch:-master}
+		if [ "$master_branch" != "master" ]; then
+			git config gitflow.branch.master "$master_branch"
+		fi
+	else
+		master_branch=$(git config --get gitflow.branch.master)
+		master_branch=${master_branch:-master}
 	fi
 
-	if ! git rev-parse --verify "$MASTER_BRANCH" >/dev/null 2>&1; then
-		die "Cannot find your master branch. Try: git branch -m <mymaster> $MASTER_BRANCH"
+	# add a develop branch if no such branch exists yet
+	local develop_branch
+	if ! git config --get gitflow.branch.develop; then
+
+		# next, ask how to create the develop branch
+		echo
+		echo "Which branch should be used for developing the \"next release\"?"
+		branch_count=$(gitflow_all_branches | grep -v "^${master_branch}\$" | wc -l)
+		if [ "$branch_count" -gt 0 ]; then
+			gitflow_all_branches | grep -v "^${master_branch}\$" | sed 's/^.*$/   - &/g'
+			echo "You may use an existing branch name, or specify a new one."
+		fi
+		echo "Branch name for \"next release\" development: [develop] \c"
+		read develop_branch
+
+		develop_branch=${develop_branch:-develop}
+		if [ "$develop_branch" != "develop" ]; then
+			git config gitflow.branch.develop "$develop_branch"
+		fi
+	else
+		develop_branch=$(git config --get gitflow.branch.develop)
+		develop_branch=${develop_branch:-develop}
+	fi
+
+	# perform an initial commit, if no such commit exists
+	local initialfile
+	if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
+		echo "A file is required to perform an initial commit."
+		echo "How would you like to name your initial file? [README] \c"
+		read initialfile
+		initialfile=${initialfile:-README}
+
+		# point HEAD to the not yet existing master branch
+		git symbolic-ref HEAD "refs/heads/$master_branch"
+
+		touch "$initialfile"
+		git add "$initialfile"
+		git commit --quiet -m "initial commit"
+	fi
+
+	# if the selected master branch exists, it's okay, else create it (base on
+	# the currently checked out branch)
+	if ! gitflow_branch_exists "$master_branch"; then
+		git branch "$master_branch"
+	fi
+
+	if ! gitflow_branch_exists "$develop_branch"; then
+		git branch "$develop_branch" "$master_branch"	 # base it on the master branch!
+	else
+		# TODO: Check: it should be based on the master branch (i.e. master and
+		# develop should have a merge base!)
+		gitflow_test_branches_equal "$develop_branch" "$master_branch"
+		if [ $? -eq 4 ]; then
+			warn "fatal: $develop_branch and $master_branch have no common ancestors."
+			die "fatal: $develop_branch cannot be used for development."
+		fi
 	fi
 
 	gitflow_require_clean_working_tree
 
-	if git remote | grep -q "$ORIGIN"; then
-		git fetch -q "$ORIGIN"
-		gitflow_require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
-	fi
-
-	if git rev-parse --verify "$DEVELOP_BRANCH" >/dev/null 2>&1; then
-		gitflow_require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
-	else
-		git checkout -q -b "$DEVELOP_BRANCH" "$MASTER_BRANCH"
-		echo "- A new branch '$DEVELOP_BRANCH' was created"
-		echo "- You are now on branch '$DEVELOP_BRANCH'"
-	fi
-
-	if ! git remote | grep -q "$ORIGIN"; then
-		if [ "$1" = "" ]; then
-			echo "- No remote location was added. Try: git remote add $ORIGIN <url>"
-		else
-			git remote add "$ORIGIN" "$1"
-			echo "- A new remote location '$1' was added"
-		fi
-	fi
-
-	echo
-
-	if git remote | grep -q "$ORIGIN"; then
-		git push "$ORIGIN" "$MASTER_BRANCH" "$DEVELOP_BRANCH"
-	fi
+	# checkout the develop branch to start working
+	git checkout -q "$develop_branch"
 }
 
 cmd_help() {