当 PR 重新基于 github 时,为什么提交会出现分歧?

Why is a commit diverging when the PR is rebased on github?

我的情况非常简单 git,但由于某种原因,我遇到了以下问题。让我们假设以下起点:

                H
master (1) - - (2)

我有我的 master 分支,我想标记它并推送到 github。我将 master 分支到 rel-0.0.x,更改 npmpackage.json、提交和标记的版本。

master (1) - - (2)
rel-0.0.x        \ - - (3)
                        H & v0.0.x

在 github 中,一旦 PR 被审查,它就会变基并合并(master 中没有其他变化,所以我的假设是变基不应该改变提交的父级)。为什么我最终会有这个新提交(当然不再标记)?我可以在 github 中看到,合并的提交哈希与我推送的不同。我应该合并而不是变基吗?我确实喜欢线性历史,尤其是当它有意义的时候...

master (1) - - (2) - - (3') <-- this is fetched from github
rel-0.0.x        \ - - (3)
                        v0.0.x

我通常会直接在 github 上标记,但我想使用 npmversion 工具,它会自动更新版本、提交和标记。

来自 https://help.github.com/articles/about-pull-request-merges/

的文档

The rebase and merge behavior on GitHub deviates slightly from git rebase. Rebase and merge on GitHub will always update the committer information and create new commit SHAs, whereas git rebase outside of GitHub does not change the committer information when the rebase happens on top of an ancestor commit. For more information about git rebase, see the "Git rebase" chapter from the Pro Git book.