为什么 git-flow 正在快速转发我的功能分支合并?
Why git-flow is fast forwarding my feature branch merge?
我开始使用和学习 git-flow。通过阅读这篇文章 https://jeffkreeftmeijer.com/git-flow/,它指出每个功能分支合并都将使用 --no-ff 参数到 git merge
,考虑到功能分支的目的,这很有意义。
问题是我正在一个空的 repo 中测试 git-flow,我无法弄清楚为什么使用命令 git flow feature finish "feature-name"
从功能分支合并总是使用快速转发。
我想不出为什么要快进功能分支的原因。我在这里遗漏了什么吗?
有一种情况,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.
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git_do merge --ff "$BRANCH"
我开始使用和学习 git-flow。通过阅读这篇文章 https://jeffkreeftmeijer.com/git-flow/,它指出每个功能分支合并都将使用 --no-ff 参数到 git merge
,考虑到功能分支的目的,这很有意义。
问题是我正在一个空的 repo 中测试 git-flow,我无法弄清楚为什么使用命令 git flow feature finish "feature-name"
从功能分支合并总是使用快速转发。
我想不出为什么要快进功能分支的原因。我在这里遗漏了什么吗?
有一种情况,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.
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git_do merge --ff "$BRANCH"