While we're user input in git flow init, ask the user for all prefix
conventions, too.
diff --git a/git-flow-init b/git-flow-init
index f443e33..71d577d 100644
--- a/git-flow-init
+++ b/git-flow-init
@@ -46,6 +46,7 @@
fi
local branch_count
+ local answer
# add a master branch if no such branch exists yet
local master_branch
@@ -176,8 +177,46 @@
git checkout -q "$develop_branch"
fi
- # TODO: finally, ask the user for naming convention preferences
- # i.e. tag prefixes, prefixes for supporting branches, etc.
+ # finally, ask the user for naming conventions (branch and tag prefixes)
+ echo
+ echo "How to name your supporting branch prefixes?"
+
+ local prefix
+
+ # Feature branches
+ default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/)
+ echo "Feature branches? [$default_suggestion] \c"
+ read answer
+ prefix=${answer:-$default_suggestion}
+ git config gitflow.prefix.feature "$prefix"
+
+ # Release branches
+ default_suggestion=$(git config --get gitflow.prefix.release || echo release/)
+ echo "Release branches? [$default_suggestion] \c"
+ read answer
+ prefix=${answer:-$default_suggestion}
+ git config gitflow.prefix.release "$prefix"
+
+ # Hotfix branches
+ default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
+ echo "Hotfix branches? [$default_suggestion] \c"
+ read answer
+ prefix=${answer:-$default_suggestion}
+ git config gitflow.prefix.hotfix "$prefix"
+
+ # Support branches
+ default_suggestion=$(git config --get gitflow.prefix.support || echo support/)
+ echo "Support branches? [$default_suggestion] \c"
+ read answer
+ prefix=${answer:-$default_suggestion}
+ git config gitflow.prefix.support "$prefix"
+
+ # Version tag prefix
+ default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "")
+ echo "Version tag prefix? [$default_suggestion] \c"
+ read answer
+ prefix=${answer:-$default_suggestion}
+ git config gitflow.prefix.versiontag "$prefix"
# TODO: what to do with origin?
}