Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
gitflow
Commits
d2eccaa7
Commit
d2eccaa7
authored
Feb 04, 2011
by
Joseph A. Levin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue: 88
Added support for using defaults without prompts when using git flow init.
parent
1b471a66
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
9 deletions
+42
-9
git-flow-init
git-flow-init
+42
-9
No files found.
git-flow-init
View file @
d2eccaa7
...
...
@@ -37,7 +37,7 @@
#
usage() {
echo "usage: git flow init [-f]"
echo "usage: git flow init [-f]
[--defaults]
"
}
parse_args() {
...
...
@@ -49,8 +49,9 @@ parse_args() {
# Default entry when no SUBACTION is given
cmd_default() {
DEFINE_boolean force false 'force setting of gitflow branches, even if already configured' f
DEFINE_boolean defaults false 'use default branch names' 'defaults'
parse_args "$@"
if ! git rev-parse --git-dir >/dev/null 2>&1; then
git init
else
...
...
@@ -101,9 +102,17 @@ cmd_default() {
fi
done
fi
if flag defaults; then
warn "Using default branch names."
fi
printf "Branch name for production releases: [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
master_branch=${answer:-$default_suggestion}
# check existence in case of an already existing repo
...
...
@@ -146,7 +155,11 @@ cmd_default() {
fi
printf "Branch name for \"next release\" development: [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
develop_branch=${answer:-$default_suggestion}
if [ "$master_branch" = "$develop_branch" ]; then
...
...
@@ -216,7 +229,11 @@ cmd_default() {
if ! git config --get gitflow.prefix.feature >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.feature || echo feature/)
printf "Feature branches? [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.feature "$prefix"
fi
...
...
@@ -225,7 +242,11 @@ cmd_default() {
if ! git config --get gitflow.prefix.release >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.release || echo release/)
printf "Release branches? [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.release "$prefix"
fi
...
...
@@ -235,7 +256,11 @@ cmd_default() {
if ! git config --get gitflow.prefix.hotfix >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.hotfix || echo hotfix/)
printf "Hotfix branches? [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.hotfix "$prefix"
fi
...
...
@@ -245,7 +270,11 @@ cmd_default() {
if ! git config --get gitflow.prefix.support >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.support || echo support/)
printf "Support branches? [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.support "$prefix"
fi
...
...
@@ -255,7 +284,11 @@ cmd_default() {
if ! git config --get gitflow.prefix.versiontag >/dev/null 2>&1 || flag force; then
default_suggestion=$(git config --get gitflow.prefix.versiontag || echo "")
printf "Version tag prefix? [$default_suggestion] "
read answer
if ! flag defaults; then
read answer
else
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.versiontag "$prefix"
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment