gpt4 book ai didi

git - 如何在使用 git merge 时将 "fast forward"设置为默认值

转载 作者:IT王子 更新时间:2023-10-29 01:16:37 69 4
gpt4 key购买 nike

来自git book :

You’ll notice the phrase "Fast forward" in that merge. Because the commit pointed to by the branch you merged in was directly upstream of the commit you’re on, Git moves the pointer forward. To phrase that another way, when you try to merge one commit with a commit that can be reached by following the first commit’s history, Git simplifies things by moving the pointer forward because there is no divergent work to merge together — this is called a "fast forward".

但是,这种“快进”的副作用是,如果您有一个包含多次提交的功能分支,那么当您 merge 回主分支时,您将丢失该功能的历史上下文。换句话说,提交不会作为此功能的一部分组合在一起。

with fast forward:     x---x---x---x---x---x---x

without fast forward: x---x---x x---x---x---x
\x--x--x/

手动方式是git merge --no-ff

有谁知道如何将其设置为默认值?

最佳答案

将配置变量 merge.ff 设置为 false:

git config --global merge.ff false

(不使用--global将效果限制在当前项目)

关于git - 如何在使用 git merge 时将 "fast forward"设置为默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16453941/

69 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com