有没有办法避免手动配置 git 流?

Is there a way to avoid manually configuring git flow?

场景:鼓励对特定存储库使用 git flow。现在,任何签出存储库的人都必须 运行 git flow init 并希望默认值 conventions/settings 对于此存储库是正确的。

有没有办法让存储库直接告诉 git flow init 它应该使用什么设置,而不提示用户?

您可以在您的项目存储库中创建一个 .gitconfig(或您想要的任何名称)并提交它。

您将需要 运行 一个 git config 命令(见下文)告诉 git 使用这个文件,然后它将使用其中指定的默认值。

git flow init 中的 -d 选项告诉它使用默认值,而不提示用户。

它确实添加了一个需要 运行(本地配置设置)的额外命令,但我看不出有什么方法可以在不要求用户 运行 一些自定义的情况下执行此操作命令。

样本.gitconfig

[gitflow "branch"]
        master = m
        develop = d
[gitflow "prefix"]
        feature = f/
        bugfix = b/
        release = r/

正在设置

git config --local include.path ../.gitconfig
git flow init -d

结果

$ git branch
* d
  m

$ git flow feature start foo
Switched to a new branch 'f/foo'

Summary of actions:
- A new branch 'f/foo' was created, based on 'd'
- You are now on branch 'f/foo'