gpt4 book ai didi

git - 为什么 git-flow 快速转发我的功能分支 merge ?

转载 作者:行者123 更新时间:2023-12-05 03:01:28 24 4
gpt4 key购买 nike

我开始使用和学习 git-flow。通过阅读本文https://jeffkreeftmeijer.com/git-flow/它声明每个功能分支 merge 都将使用 --no-ff 参数到 git merge 考虑到功能分支的目的,这很有意义。

问题是我在一个空的 repo 中测试 git-flow,我无法弄清楚为什么使用命令 git flow feature finish "feature-name" 从功能分支 merge > 始终使用快进。

我想不出为什么要快进功能分支的原因。我在这里遗漏了什么吗?

最佳答案

有一种情况,git-flow 确实没有使用 --no-ff:
Look at GitHub issue #100 comment from Vincent Driessen :

By design, git-flow uses the --no-ff option when merging  
in order to record that the commits belong together historically.
However, when the feature branch contains only a single commit,
the extra merge commit does not add anything and only complicates
the branch tree needlessly.
So for single-commit branches, fast-forward merges are being made
as if the commit was done on develop directly.

应该是this line of code #315 :

if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git_do merge --ff "$BRANCH"

关于git - 为什么 git-flow 快速转发我的功能分支 merge ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55688222/

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