如果要求摘樱桃,我该怎么办? [英] What do I do when a pull request is cherry picked?

查看:148
本文介绍了如果要求摘樱桃,我该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub上分发了一个项目,推进了一些更改,并打开了一个pull请求。维护者签名并将这些更改应用于新的提交(而不是合并提交),因此提交图如下所示:

  * 03a0687(origin / master)frotz:更正了MAN_PREFIX 
| * 11d3e98(HEAD,master,jleedev / master)frotz:更正MAN_PREFIX
| /
* 9c3dd1a yajl:使用Github的直接补丁。

显然,我必须重新绑定或强制更新我的本地分支。然后我必须强制推送到GitHub上的fork吗?我主要是问,因为强制更新不应该是自动的。这是标准的事情,当你的修改被维护者挑选出来的时候,这是一个标准的事情吗? 解决方案

最简单的事情就是总是在主题分支上工作。这样你的叉子主分支总是看起来像上游,所以一旦上游包括你的变化,你总是做同样的事情,只是删除你的主题分支。



如果上游合并您的更改,您的主控和主题分支都包含相同的提交,并且您可以安全地删除主题分支。如果上游樱桃挑选您的提交,然后验证更改使其向上游,您可以删除主题分支。



另一个主要优点是您可以轻松地反对主人重新分配主题分支。有时,如果补丁无法在没有手动冲突解决的情况下应用到上游,他们会要求您重新设置或合并,并自己执行冲突解决方案,因为它的代码和您对此有更多了解。我也怀疑他们选择了你的提交,因为他们在你创建了fork之后已经提交了,并且不想为少量提交引入合并提交。通过樱桃采摘,他们保持了他们的历史更线性和更清洁。如果你经常重新组合,它可能只是一个快速向前合并,他们不需要挑选。



至于你的问题现在就做,强制更新您的本地分支,然后强制推回到您的分叉是唯一真正的选择。


I forked a project on GitHub, pushed some changes, and opened a pull request. The maintainer signed-off and applied the changes in a new commit (rather than merging my commit), and so the commit graph looked like this:

* 03a0687 (origin/master) frotz: Corrected MAN_PREFIX
| * 11d3e98 (HEAD, master, jleedev/master) frotz: Corrected MAN_PREFIX
|/  
* 9c3dd1a yajl: use direct patch from Github.

Obviously, I have to either rebase or force-update my local branch. Do I then have to force-push to my fork on GitHub? I’m mainly asking because force-updating should not be automatic. Is this the standard thing to do when your changes are cherry-picked by the maintainer?

解决方案

The simplest thing to do is just always work on topic branches. That way your forks master branch always looks like upstream so that once upstream includes your changes you always do the same thing, just delete your topic branch.

If upstream merges your changes, your master and topic branch both contain the same commits and you can safely delete the topic branch. If upstream cherry-picks your commits then after verifying the changes made it to upstream you can just delete the topic branch.

The other major benefit of this is that you can easily rebase your topic branch against master. Sometimes if a patch cannot be applied upstream without manual conflict resolution they will ask you to rebase or merge and do the conflict resolution yourself, since its your code and you know more about it. I also suspect they cherry-picked your commit because they had commited after you made the fork and did not want to introduce a merge commit for only a small amount of commits. By cherry-picking they kept their history more linear and cleaner. If you had rebased often, it might have only been a fast-forward merge for them and they wouldn't need to cherry-pick.

As for your question of what to do right now, force updating your local branch and then force pushing back to your fork is the only real option you have.

这篇关于如果要求摘樱桃,我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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