git - 压缩到只有一个 "proper"提交 github pull 请求

标签 git github pull-request

我在 github 上有一个 repo,其他人(Bob,为了论证)已经为其发出了 pull request。他的代码并不完美,因此我们进行了几轮标记。据我了解,他为每组标记的更改提交并推送他的 pull 请求。

所以我的存储库现在看起来像这样:

master: ---o A (Chowlett
           |
           |
pull-req:  o---o---o---o
               B   C   D (all Bob)

提交 SHA 和消息如下:

答:

123456 Good commit <chowlett>

乙:

777ccc Fix the widget bug <bob>

C:

888ddd Review markups <bob>

D:

999eee Further markups <bob>

我现在很高兴接受这个 pull 请求;但我宁愿预标记版本不在我的仓库中。我可以实现以下所有目标吗?以及如何?

  • 将 B、C 和 D 作为单个提交 merge 到我的仓库中
  • 同时生成“Merge pull request #99 into ...”提交
  • 让github自动关闭pull request

最佳答案

请注意,Bob 在进行 GitHub PR 时不必压缩他的提交。
自 2016 年 3 月起,您可以将该操作留给接受您的 PR 的维护者(您)。

参见“Squash your commits”及其new documentation

This is a new option which lets you force commit squashing on all pull requests merged via the merge button.

https://help.github.com/assets/images/help/pull_requests/squash-and-merge.png

关于git - 压缩到只有一个 "proper"提交 github pull 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11396069/

相关文章:

Github:在 fork 的 master 上获取并重新设置 fork

ssl - Github 如何在允许通过 Markdown 显示图片的情况下维护 https?

git - 如何在不关闭 pull 请求的情况下从 pull 请求 merge 到主控中

git - 如何从 pull 请求中删除提交?

git - 在 Github 中 merge pull 请求中的一些提交

git - 如何在 Git 中创建公共(public)分支

git - 如何使用 bash 将 cd 转到最近的具有 .git 文件夹的父文件夹?

git - 在 GitHub 上搜索具有特定框架和演示的项目

Git 作为 mercurial 客户端?为什么没有 git-hg?

git - Azure 管道子模块克隆失败