git merge和git merge –no-ff的区别

在很多介绍GitFlow工作流的文章里面,都会推荐在合并分支的时候加上--no-ff参数, 而我们在合并的时候,有时git也会提示 使用了fast-forward,这里我将介绍一下merge的三种状态及 git merge 和 git merge --no-ff的区别Git merge的时候,有几种合并方式可以选择

 --ff
    When the merge resolves as a fast-forward, only update the branch pointer, without creating a merge commit. This is the default behavior.
 --no-ff
    Create a merge commit even when the merge resolves as a fast-forward. This is the default behaviour when merging an annotated (and possibly signed) tag.
 --squash
 --no-squash
    Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to cause the next git commit command to create a merge commit). This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus).
    With --no-squash perform the merge and commit the result. This option can be used to override --squash.
继续阅读git merge和git merge –no-ff的区别