我可以在git中默认关闭快进吗? [英] Can I make fast forwarding be off by default in git?
问题描述
我真的不会想到我会使用 git merge
而不是 git rebase
和不是想要显示提交。有什么办法可以让git默认快速关闭吗?事实上,有一个 - ff
选项似乎暗示有一种方法,但我似乎无法在文档中找到它。
是的,有 - no-ff
。您可以为每个分支配置合并选项,例如
git config branch.master.mergeoptions--no-ff
将 $(REPO)/。git / config
$ $ $ $ $ $ $ $ $ $ $ $ $ $ $
脚注:说到我的经验,快进到关闭主要对git新手有帮助 - 但是一旦工作流程和概念的感觉开始下沉,您绝对要避免使用大量毫无意义的合并远程..blarf类型提交模糊日志图。
I can't really ever think of a time when I would use git merge
rather than git rebase
and not want to have a commit show up. Is there any way to configure git to have fast forwarding off by default? The fact that there's an --ff
option would seem to imply that there's a way, but I can't seem to find it in the documentation.
Yes, there is --no-ff
. You can configure merge options per branch, e.g.
git config branch.master.mergeoptions "--no-ff"
adds the following to your $(REPO)/.git/config
file:
[branch "master"]
mergeoptions = --no-ff
Footnote: speaking of my experience, I eventually found switching fast-forward to off was mostly helpful for git newcomers - however once the feel for workflows and concepts start to sink in you definitely want to avoid blurring your log graph with tons of pointless 'merged remote ..blarf' type commits.
这篇关于我可以在git中默认关闭快进吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!