Github压缩在审核评论后从Web界面提交请求时提交? [英] Github squash commits from web interface on pull request after review comments?
问题描述
一个常见的用例是: p>
- 进行本地提交,处理特性
- 压扁提交
- 提出申请请求
- 收到评论评论
- 更新公告信息
我可以在我的机器上本地执行此操作,然后再次推送我的更改(使用-f,因为rebase使其与远程不同步)。这是令人讨厌的。
但是,这需要我每次做一次rebase 我处理评论意见 - 有什么方法可以从网络界面执行此操作?或者,也许我的工作流程是错误的,我是否应该将每个审核意见直接提交到主要PR提交?
div class =h2_lin>解决方案
您不必在本地进行任何rebase / squashing:只需将您的提交推送到您的PR分支。
原始回购的所有者,如果他/她选择的话,将会为你压缩这些提交(自2016年3月起):
请参阅压扁你的提交和文档:它确实允许一个新的工作流程,无论是你的贡献者还是维护者原始回购。
正如我在下面评论的那样:它会像执行PR合并一样执行:
merge --squash
:参见在git中, merge --squash
和 rebase
?)将自动创建。
这真的和现在一样,除了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 betweenmerge --squash
andrebase
?") 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屋!