简体   繁体   English

为分支请求合并或重新设置分支上的更改?

[英]Merge or rebase changes on branches for pull requests?

Sometimes we fork an upstream project to contribute bug fixes. 有时,我们会分叉一个上游项目来提供错误修复。 We check out a new branch, commit changes and send a pull request to upstream. 我们签出一个新分支,提交更改并向上游发送拉取请求。 But it may take some time for the pull request to be handled and during this time additional changes may occur in the upstream. 但是处理拉取请求可能需要一些时间,在此期间,上游可能会发生其他更改。 In this case, should we merge the new upstream head or rebase our changes on it? 在这种情况下,我们应该合并新的上游标头还是将其更改作为基础?

If our repository is private, I think rebase gives a cleaner history. 如果我们的存储库是私有的,我认为rebase提供了更清晰的历史记录。 But there is a principle that you shouldn't rebase commits that have been published remotely. 但是有一个原则,您不应该为已经远程发布的提交重新设置基础。 When we are using public git servers such as github, does this mean merging is our only choice? 当我们使用诸如github之类的公共git服务器时,这是否意味着合并是我们的唯一选择? Is it recommended that we leave the branch as it is for upstream developers to handle (ie non-fast-forwards)? 是否建议我们离开分支机构,以便上游开发人员处理(即非快进)?

如果已经发布了某些内容,则不重新设置基准的原则适用于人们可能正在其工作的分支(例如,主人。...一旦在master上发布了某些东西,就会有很多人在获取,合并它,在其上重新建立基础,等等...所以移动它有点痛苦)...但是大多数功能分支从完成的那一刻起就无法使用(这是您从中创建PR的地方)因此,如果它是一个功能分支,并且没有人在它上面工作,请随时为它重新设置基础。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM