我可以在git中默认关闭快进吗? [英] Can I make fast forwarding be off by default in git?

查看:84
本文介绍了我可以在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆