[英]git merge with --no-commit as default
I am trying to set git merge --no-ff --no-commit
as a default behaviour for merge.我正在尝试将
git merge --no-ff --no-commit
设置为合并的默认行为。
Now I have read below questions:现在我已经阅读了以下问题:
How do I make git merge's default be --no-ff --no-commit? 如何使 git 合并的默认值为 --no-ff --no-commit?
Git: Default "no commit" merge behaviour for all branches? Git:所有分支的默认“无提交”合并行为?
Following those answers, I added below to global config:根据这些答案,我在下面添加到全局配置:
[merge]
tool = winmerge
ff = false
commit = false
After adding new configurations --no-ff works correctly, but it still automatically commits.添加新配置后 --no-ff 可以正常工作,但仍会自动提交。 Then I searched for tried merge-documentation page:
然后我搜索了尝试过的合并文档页面:
https://git-scm.com/docs/merge-config/2.18.0 https://git-scm.com/docs/merge-config/2.18.0
There is merge.ff entry but not merge.commit.有 merge.ff 条目,但没有 merge.commit。 I'm currently using git version 2.29.2.windows.2.
我目前正在使用 git 版本 2.29.2.windows.2。
I added --no-commit to local config mergeoptions for a workaround:我将 --no-commit 添加到本地配置合并选项以作为解决方法:
[branch "master"]
mergeoptions = --no-commit
It works for now, but I would like to have that behaviour default for all projects and branches on my pc.它现在可以工作,但我希望我的电脑上的所有项目和分支都默认使用这种行为。
So my questions are below:所以我的问题如下:
There is no merge.commit
option: see the source code , where you can see which options are handled, and observe the lack of a merge.commit
option.没有
merge.commit
选项:查看源代码,您可以在其中查看处理了哪些选项,并观察缺少merge.commit
选项。 There was no such option in 2014 either (clone and inspect the Git source to verify this, if you like). 2014 年也没有这样的选项(如果您愿意,请克隆并检查 Git 源以验证这一点)。
The merge.ff
option has been around since then, but merge.commit
has, as far as I can tell, never existed.从那时起,
merge.ff
选项就一直存在,但据我所知, merge.commit
从未存在过。 You can of course run a command other than git merge
to start merging, and by doing that, you can make this command supply --no-commit
as an explicit argument.您当然可以运行
git merge
以外的命令来开始合并,通过这样做,您可以将此命令提供--no-commit
作为显式参数。 Note, however, that you cannot alias Git built-ins, so there is no way to make a Git alias that inserts --no-commit
when you run git merge
.但是请注意,您不能为 Git 内置别名,因此无法在运行
git merge
时创建插入--no-commit
的Git别名。 Run git mymerge
and make that a Git alias, or run mymerge
and make that a shell alias, but do not run git merge
. Run
git mymerge
and make that a Git alias, or run mymerge
and make that a shell alias, but do not run git merge
.
(Your other option is of course to set branch. name .mergeoptions
for every branch name.) (您的另一个选择当然是为每个分支名称设置
branch. name .mergeoptions
。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.