github - 为什么 Github 中的 "rebase and merge"选项会创建新的提交 SHA?有替代方案吗?

标签 github

我喜欢在 Github 中使用“rebase and merge”选项来合并 PR,以避免将提交历史与合并提交混淆。

但我注意到以下行为:
(来自 Github 的 docs )

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.



这对我来说似乎很奇怪,因为这不是 git CLI 中 rebase 的工作方式。有谁知道它为什么会这样?

理想情况下,我希望 a) 避免引入合并提交和 b) 保留功能分支中的提交 SHA 和标签。有没有办法从用户界面做到这一点?

最佳答案

您的欣赏是正确的,这不是 rebase 在 git 中的工作方式。原因是在 GitHub 中,一些选项命名不当:

  • 挤压和合并 : 类似于 Squash 和 rebase
  • rebase 和合并 : 类似于带有 --no-ff 的 rebase 。选项(即使提交是最新的,也会引入新的提交)

  • 如果您使用的是“GitHub Desktop”应用程序,您应该会看到其他不熟悉的名称,例如“Sync”而不是“Pull”+“Merge”+“Push”。

    关于github - 为什么 Github 中的 "rebase and merge"选项会创建新的提交 SHA?有替代方案吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48350294/

    相关文章:

    windows - Git - 推送新的提交并忽略未提交的更改

    GitHub 拉取请求评论行评论行为

    git - GitHub 能很好地处理大型存储库吗?

    git - 如何链接到 GitHub 上的特定行号

    python - 如何有效地使用 jenkins、github 并将 jenkins 报告发送到电子邮件?

    git - 删除目标分支后,现有 pull 请求会发生什么情况?

    node.js - Node npm install,强制依赖的依赖安装特定版本

    Git 因 fatal error 而失败,拒绝使用 Git 推送 merge 不相关的历史记录

    git - 下载github项目的特定分支

    github - 新的 GitHub 操作在空文件夹中运行