Github压缩在审核评论后从Web界面提交请求时提交? [英] Github squash commits from web interface on pull request after review comments?

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

问题描述

假设我有5个提交的提交历史记录。我知道,我可以在提出请求时将本地提交重新绑定,然后将它们重新绑定到一个提交中。



一个常见的用例是: p>


  • 进行本地提交,处理特性

  • 压扁提交

  • 提出申请请求

  • 收到评论评论

  • 更新公告信息



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



但是,这需要我每次做一次rebase 我处理评论意见 - 有什么方法可以从网络界面执行此操作?或者,也许我的工作流程是错误的,我是否应该将每个审核意见直接提交到主要PR提交?


div class =h2_lin>解决方案

您不必在本地进行任何rebase / squashing:只需将您的提交推送到您的PR分支。



原始回购的所有者,如果他/她选择的话,将会为你压缩这些提交(自2016年3月起):



请参阅压扁你的提交文档:它确实允许一个新的工作流程,无论是你的贡献者还是维护者原始回购。



正如我在下面评论的那样:它会像执行PR合并一样执行:


  • 如果它没有冲突,合并(或在这里, merge --squash :参见在git中, merge --squash rebase ?)将自动创建。

  • 如果存在任何冲突,则不会创建合并,并且维护者可以选择现在拒绝PR,要求撰稿人完成压缩提交和修改提交的工作PR。



这真的和现在一样,除了GitHub添加了 - squash 到它们的合并命令。没有更多。


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.

A common use case for this is:

  • Make local commits, working on feature
  • Squash commits
  • Make Pull Request
  • Receive review comments
  • Update PR appropriately

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.

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?

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

解决方案

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

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.

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.

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

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

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