git flow init -d默认建议为空

时间:2019-03-20 14:26:50

标签: git git-flow

我在Windows上使用Git flow。当我通过

初始化我的仓库时
git flow init -d 

我得到以下输出

Which branch should be used for bringing forth production releases?
- develop
- master
 Branch name for production releases: [master]

Which branch should be used for integration of the "next release"?
  - develop
Branch name for "next release" development: [develop]

How to name your supporting branch prefixes?
Feature branches? []
Bugfix branches? []
Release branches? []
Hotfix branches? []
Support branches? []
Version tag prefix? []

可以看出,默认前缀为空。谁能告诉我这些前缀在哪个配置文件中设置?

问题是我正在使用PowerShell脚本克隆多个存储库并通过git flow init -d初始化存储库,因此我需要默认值。

Thx

3 个答案:

答案 0 :(得分:2)

与VSCode和devcontainer一起使用时,我遇到了同一问题。使用的版本是:

root@abc64e31b32e:/workspace# git flow version
1.12.0 (AVH Edition)

注意:这实际上不起作用。第一次初始化在一个空的仓库上,导致.git/config不包含[gitflow "prefix"]部分。执行git flow feature start ABC时,默认使用global节来创建feature/ABC分支。进行后续的git flow init --default -f会导致看到相同的错误。

Ubuntu 20.04软件包报告了一个错误:https://bugs.launchpad.net/ubuntu/+source/git-flow/+bug/1860086

使用GitHub上的 1.12.3版本替换apt git-flow:1.12.0软件包中已安装的gitflow / git-flow文件,即可解决此问题

wget https://github.com/petervanderdoes/gitflow-avh/archive/1.12.3.tar.gz
tar xzf 1.12.3.tar.gz 
cd gitflow-avh-1.12.3/
cp git* /usr/lib/git-core/

另一种方法是在全局级别设置前缀:

git config --global gitflow.prefix.feature 'feature/';
git config --global gitflow.prefix.bugfix 'bugfix/';
git config --global gitflow.prefix.release 'release/';
git config --global gitflow.prefix.hotfix 'hotfix/';
git config --global gitflow.prefix.support 'support/';
git config --global gitflow.prefix.versiontag '';
git config --global gitflow.branch.master master;

端到端示例,之前和之后:

注意::全局master分支配置实际上不执行任何操作。即使使用1.12.3版。

root@abc64e31b32e:/workspace# mkdir wrong
root@abc64e31b32e:/workspace# cd wrong
root@abc64e31b32e:/workspace/wrong# git init
Initialized empty Git repository in /workspace/wrong/.git/
root@abc64e31b32e:/workspace/wrong# git flow init --defaults
Using default branch names.
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 

How to name your supporting branch prefixes?
Feature branches? [] 
Bugfix branches? [] 
Release branches? [] 
Hotfix branches? [] 
Support branches? [] 
Version tag prefix? [] 
Hooks and filters directory? [/workspace/wrong/.git/hooks] 
root@abc64e31b32e:/workspace/wrong# cd ..
root@abc64e31b32e:/workspace#     git config --global gitflow.prefix.feature 'feature/';
root@abc64e31b32e:/workspace#     git config --global gitflow.prefix.bugfix 'bugfix/';
root@abc64e31b32e:/workspace#     git config --global gitflow.prefix.release 'release/';
root@abc64e31b32e:/workspace#     git config --global gitflow.prefix.hotfix 'hotfix/';
root@abc64e31b32e:/workspace#     git config --global gitflow.prefix.support 'support/';
root@abc64e31b32e:/workspace#     git config --global gitflow.prefix.versiontag '';
root@abc64e31b32e:/workspace#     git config --global gitflow.branch.master master;
root@abc64e31b32e:/workspace# mkdir working
root@abc64e31b32e:/workspace# cd working
root@abc64e31b32e:/workspace/working# git init
Initialized empty Git repository in /workspace/working/.git/
root@abc64e31b32e:/workspace/working# git flow init --defaults
Using default branch names.
No branches exist yet. Base branches must be created now.
Branch name for production releases: [master] 
Branch name for "next release" development: [develop] 
Hooks and filters directory? [/workspace/working/.git/hooks] 
root@abc64e31b32e:/workspace/working# git flow feature start ABC
Switched to a new branch 'feature/ABC'

Summary of actions:
- A new branch 'feature/ABC' was created, based on 'develop'
- You are now on branch 'feature/ABC'

Now, start committing on your feature. When done, use:

     git flow feature finish ABC

root@abc64e31b32e:/workspace/working# 

答案 1 :(得分:1)

这可能是错误,也可能是自愿更改:至少有人对此发布了github issue

在此期间,您可以使用:

git flow init -d --feature feature/  --bugfix bugfix/ --release release/ --hotfix hotfix/ --support support/ -t ''

答案 2 :(得分:0)

您可以简单地使用命令,不间断地运行 Git Init,您将获得默认值:

<块引用>

git flow init -fd