通过GitHub提交拉取请求的正确方法(在贡献开源时) [英] Proper way to submit pull request via GitHub (when contributing to open source)

查看:62
本文介绍了通过GitHub提交拉取请求的正确方法(在贡献开源时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从GitHub分叉并克隆了一个项目,然后从master分支下进行了更改.一旦我进行了更改并想要提交请求请求,并且想知道什么是最好的方式.

I've forked and cloned a project from GitHub, then made a branch off master to make my changes. 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)直接向分支机构外部的上游仓库提交拉取请求,然后稍后将分支与主仓库中的主仓库合并

(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

(2)首先将分支与master合并到我的仓库中,然后从我的master向上游仓库提交拉取请求吗?

(2) Merge my branch with master in my repo first, then submit a pull request to the upstream repo from my master?

推荐答案

根据经验,不应在master分支上进行开发.尽管从技术上来说可以,但master分支通常用于跟踪项目的当前状态.由于您的拉取请求尚未被接受,因此它不能反映当前状态,将其合并到本地主机中只会引起混乱.最佳做法是这样的:

As a rule of thumb, you should not develop on the master branch. Although you technically can, the master branch is usually used to track the current state of the project. 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:

  1. 分叉项目
  2. 创建本地功能分支(例如 git checkout -b myfeature )
  3. 在本地开发,测试和验证.
  4. 将本地功能分支推送到GitHub帐户上的远程分支(例如 git push origin myfeature ).
  5. 从功能分支(您的名称/myfeature )创建到主分支( projectowner/master )的拉取请求.
  6. 获取评论,根据需要修复拉动请求
  7. 项目维护者合并您的请求请求
  8. 使用合并的补丁程序更新您自己的本地主服务器(例如, git提取上游&& git rebase上游/主服务器).
  1. Fork the project
  2. Create a local feature branch (e.g., git checkout -b myfeature)
  3. Develop, test and validate locally.
  4. Push the local feature branch to a remote branch on your GitHub account (e.g., git push origin myfeature).
  5. Create a pull request from your feature branch (yourname/myfeature) to the master branch (projectowner/master).
  6. Get reviewed, fix pull request as needed
  7. Project maintainer merges your pull request
  8. Update your own local master with the merged patch (e.g., git fetch upstream && git rebase upstream/master).

这篇关于通过GitHub提交拉取请求的正确方法(在贡献开源时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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