git flow init -d 默认建议为空

git flow init -d default suggestions are empty

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

初始化我的 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 初始化存储库,所以我需要默认值。

感谢

这可能是错误或自愿更改:至少有人发布了关于此的 github issue

在此期间,您可以使用:

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:改为 this issue is asking the author, nvie, to mark the repository (?) as deprecated and make git-flow point in homebrew to git-flow-avh

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

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

注意: 这实际上不起作用。第一个 init 在一个空的 repo 上,导致 .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 版本替换 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# 

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

git flow init -fd