Permalink
Browse files

While we're user input in git flow init, ask the user for all prefix

conventions, too.
  • Loading branch information...
1 parent 3227d80 commit f476d260b0c10f60af1acaca9edf5fcd06547b8c @nvie committed Feb 20, 2010
Showing with 41 additions and 2 deletions.
  1. +41 −2 git-flow-init
View
@@ -46,6 +46,7 @@ cmd_default() {
fi
local branch_count
+ local answer
# add a master branch if no such branch exists yet
local master_branch
@@ -176,8 +177,46 @@ cmd_default() {
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?
}

0 comments on commit f476d26

Please sign in to comment.