简体   繁体   English

GitHub:请求请求:请求请求后是否必须分支?

[英]GitHub: Pull Requests: do I have to branch after a pull request?

Suppose I fork a GitHub project and make some changes and then create a pull request for the changes to be merged into the original project I forked from. 假设我派生一个GitHub项目并进行一些更改,然后创建一个拉取请求,以将更改合并到我从中派生的原始项目中。

Once I do this, if I return to my forked project and commit more files to this forked project, then these files show up in the pull request, which is not what I want. 一旦执行此操作,如果我返回我的派生项目并向该派生项目提交更多文件,则这些文件将显示在请求中,这不是我想要的。

So, how do I solve this issue? 那么,我该如何解决这个问题? Do I have to branch after each pull request to prevent further commits into the forked code to be pulled into the original code by one of the main code developers/maintainers? 我是否必须在每个请求请求之后分支,以防止对主要代码开发人员/维护人员之一将派生代码进一步提交到派生代码中?

Thanks. 谢谢。

You should branch before the pull request. 您应该拉取请求之前分支。

Implement each pull request (feature or fix) in its own branch, then submit a PR for the branch. 在其自己的分支中实现每个拉取请求(功能或修复),然后为该分支提交PR。

If the repo owner asks you to change something in a PR, add a commit in the PR branch. 如果回购所有者要求您更改PR中的某些内容,请在PR分支中添加提交。

If you want to start working on something else, no problem: you start a new branch from the master branch. 如果您想开始其他工作,那没问题:您可以从master分支开始一个新分支。

If you want your master branch to be identical to the original repo's master branch, no problem, because you haven't made any change to master. 如果您希望您的master分支与原始仓库的master分支相同,那没问题,因为您没有对master进行任何更改。 So you can simply pull the upstream master branch. 因此,您可以简单地拉起上游master分支。

If a PR is rejected, no problem. 如果PR被拒绝,没问题。 You can simply delete the branch containing the PR. 您可以简单地删除包含PR的分支。 Your master hasn't been modified. 您的母版尚未修改。

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

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