Github 壁球在审查评论后从 Web 界面提交拉取请求? [英] Github squash commits from web interface on pull request after review comments?

查看:35
本文介绍了Github 壁球在审查评论后从 Web 界面提交拉取请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有 5 次提交的提交历史记录.我知道我可以在发出拉取请求时在本地重新设置我的提交,然后将它们重新设置为单个提交.

Let's say I have a commit history with 5 commits. I know that I can rebase my commits locally when making a pull request which will then have them rebased into a single commit.

一个常见的用例是:

  • 进行本地提交,处理功能
  • 壁球提交
  • 发出拉取请求
  • 接收审核意见
  • 适当更新 PR

我可以在我的机器上本地执行此操作,然后再次推送我的更改(使用 -f,因为 rebase 使其与远程不同步).这有点烦人.

I can do this locally on my machine and then push my change again (using -f since the rebase makes it out of sync with the remote). This is kind of annoying.

但是,这要求我每次处理评论评论时都进行重新设置 - 有什么方法可以从 Web 界面执行此操作吗?

However, this requires that I do a rebase every time I address review comments - is there any way I can do this from the web interface?

或者我的工作流程是错误的,我是否应该将我的每个评论评论"直接修改到主要的 PR 提交上?

Or maybe my workflow is wrong, should I be amending each of my "review comments" commits directly onto the main PR commit?

推荐答案

您不必再在本地执行任何变基/压缩:只需将您的提交推送到您的 PR 分支.

You don't have to do any rebase/squashing locally anymore: just push your commit to your PR branch.

原始存储库的所有者(如果他/她选择这样做)将为您压缩这些提交(自 2016 年 3 月起):

The owner of the original repo, if he/she chose to, will squash those commits for you (since March 2016):

请参阅压缩您的提交"和文档:它确实允许一个新的工作流程,无论是对你的贡献者,以及原始存储库的维护者.

See "Squash your commits" and the documentation: it does allow for a new workflow, both for you the contributor, and the maintainer of the original repo.

正如我在下面评论的那样:它将像实施 PR 的合并一样实施:

As I comment below: it will be implemented like the merge of a PR is implemented:

  • If it works without conflict, the merge (or here, the merge --squash: see "In git, what is the difference between merge --squash and rebase?") will be created automatically.
  • If there is any conflict, the merge is not created, and the maintainer has the option to reject for now the PR, asking the contributor to do the work of squashing the commits and amending the PR.

这真的很像现在存在的东西,除了 GitHub 在他们的合并命令中添加了 --squash.仅此而已.

This is really like what exists now, except GitHub has added the --squash to their merge command. Nothing more.

这篇关于Github 壁球在审查评论后从 Web 界面提交拉取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆