我开始使用并了解git-flow。通过阅读本文https://jeffkreeftmeijer.com/git-flow/,它指出,每个功能分支合并都将对 c3 c4
c1 c2
one A **100** 3
B 103 6
three A 102 6
B 105 3
two A 101 4
B 104 **0**
使用--no-ff参数,这对于考虑功能分支的目的是有道理的。
问题是我在一个空的仓库中测试git-flow,我不知道为什么使用命令git merge
从功能分支进行合并总是使用快速转发。
我无法想象为什么要快速前进功能分支的原因。我在这里想念东西吗?
答案 0 :(得分:2)
在某些情况下,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"