[英]Proper way to submit pull request via GitHub (when contributing to open source)
I've forked and cloned a project from GitHub, then made a branch off master to make my changes. 我已经从GitHub分叉并克隆了一个项目,然后从master分支下进行了更改。 Once I've made changes and want to submit a pull request, and was wondering what would be the best way to do it.
一旦进行了更改并想要提交请求,就想知道什么是最好的方法。
(1) Submit a pull request to the upstream repo directly off of my branch, then merge my branch with master in my repo later on (1)直接向分支机构外部的上游仓库提交拉取请求,然后在以后的仓库中将分支与主仓库合并
or 要么
(2) Merge my branch with master in my repo first, then submit a pull request to the upstream repo from my master? (2)首先将分支与主存储合并到我的存储库中,然后从主存储库向上游存储库提交拉取请求?
As a rule of thumb, you should not develop on the master branch. 根据经验,您不应在master分支上进行开发。 Although you technically can, the master branch is usually used to track the current state of the project.
尽管从技术上来说可以,但master分支通常用于跟踪项目的当前状态。 Since your pull request was not accepted yet, it does not reflect the current state, and merging it to your local master will just cause confusion.
由于您的拉取请求尚未被接受,因此它不能反映当前状态,将其合并到本地主机中只会造成混乱。 The best practice would be something like this:
最佳做法是这样的:
git checkout -b myfeature
) git checkout -b myfeature
) git push origin myfeature
). git push origin myfeature
)。 yourname/myfeature
) to the master branch ( projectowner/master
). yourname/myfeature
)到master分支( projectowner/master
)的拉取请求。 git fetch upstream && git rebase upstream/master
). git fetch upstream && git rebase upstream/master
)。 (1) is better because you can have multiple branches - one branch per pull request. (1)更好,因为您可以有多个分支-每个拉取请求一个分支。 And you do not need to merge a PR branch to master (unless you want to).
并且您不需要合并PR分支来掌握(除非您愿意)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.