Git flow init -d默认建议为空。

4

我正在Windows上使用Git flow。当我通过以下方式初始化我的repo时

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 初始化这些仓库,所以我需要默认值。

谢谢

3个回答

9
这可能是错误或自愿更改。至少有人在GitHub问题中发布了这个问题。
同时,您可以使用以下方法:
git flow init -d --feature feature/  --bugfix bugfix/ --release release/ --hotfix hotfix/ --support support/ -t ''

正如@creativeDev所指出的那样,如果您已经执行了“git flow init”,您可以在“-d”之前添加“-f”来强制重新初始化:
git flow init -f -d --feature feature/  --bugfix bugfix/ --release release/ --hotfix hotfix/ --support support/ -t ''

更新于2020年08月25日此问题要求作者nvie将代码库标记为已弃用,并使git-flow指向git-flow-avh


1
如果您已经执行了“git flow init”,则可以在“-d”之前添加“-f”来强制重新初始化。命令如下: git flow init -f -d --feature feature/ --bugfix bugfix/ --release release/ --hotfix hotfix/ --support support/ -t '' - creativeDev

3

在使用VSCode和devcontainers时,我遇到了同样的问题。正在使用的版本是:

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

注意:此方法实际上不起作用。在空存储库上进行的第一个初始化导致.git/config文件不包含[gitflow "prefix"]部分。当执行git flow feature start ABC时,默认使用全局部分来创建feature/ABC分支。进行随后的git flow init --default -f会导致看到相同的错误。

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

通过从GitHub获取1.12.3版本并替换安装的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;

一个带有前后示例的端到端实现:

注意: 全局主分支配置实际上无效。即使在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# 

这实际上不起作用。更新了一条说明为什么的注释。 - MarkBarry

-1

您可以直接使用以下命令,无需中断即可运行 Git Init,并且您将获得默认设置:

git flow init -fd


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接