关闭常规合并的快进合并,但不是拉

oyv*_*ind 6 git git-merge fast-forward

我希望git --no-ff在我使用时总是进行merge commit()git merge,但保留默认行为(--ff)git pull.这是可能的(配置)?

Von*_*onC 10

可能有帮助的两个配置是:

merge.ff
Run Code Online (Sandbox Code Playgroud)

(来自git merge手册页):当设置为 时false,此变量告诉 Git 在这种情况下创建额外的合并提交(相当于--no-ff从命令行给出该选项)。

pull.ff
Run Code Online (Sandbox Code Playgroud)

(来自git config手册页

设置pull.fftrue将保留默认行为,即 Git 在合并作为当前提交的后代的提交时不会创建额外的合并提交。

待测试: 是否pull.ff优先于merge.ff?

git config pull.ff only
git config merge.ff false
Run Code Online (Sandbox Code Playgroud)

正如Kelvin回答所提到的并由 确认git-pull.sh,“ only”是要使用的值,而不是“ true”。