我如何创建并/或向托管在GitHub上的另一个代码库发送拉取请求?
我如何创建并/或向托管在GitHub上的另一个代码库发送拉取请求?
除了官方的 "GitHub帮助“使用拉取请求”页面",
还可以参考 "在GitHub中分叉与分支的区别", "在GitHub中origin和upstream的区别是什么"。
假设您已经分叉了一个仓库,那么您应该在您拥有的这个分叉中执行以下操作:
master
创建拉取请求,这样您可能会被诱惑积累和混合多个修改。origin/master
(确保您的补丁仍然有效),这将自动更新拉取请求(无需单击任何内容)。git remote prune origin
)。 GitHub GUI将为您提供在拉取请求页面中删除您的分支。2016年3月:新增PR合并按钮选项:请参见 "Github squash commits from web interface on pull request after review comments?".
仓库的维护者可以选择使用merge --squash
合并这些PR提交记录。
关于最后一点,自2013年4月10日起,“重新设计的合并按钮”,分支将被删除:
pull request isn't an official "git" term.
Git uses the request-pull
(!) command to build a request for merging:
It "summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary."
Github launches its own version on day one (February 2008), but redesigned that feature in May 2010, stating that:
Pull Request = Compare View + Issues + Commit comments
<幽默>
那个(pull request)在GitHub上甚至都没有得到准确的定义!
幸运的是,一个真正的商业新闻机构应该知道,在这里有一份e-note以取代“pull request”:
</humour>
branch
vs. master
时似乎是一个关键问题,这将使我的/Github的答案从理论解决方案变为实际可用的东西。 - tim petersongit pull --rebase upstream/master
是可以的。 - VonC为了学习如何发起 pull request,我只需按照 Github 上的两个帮助页面(以下以项目符号链接)分别操作即可。下面列出的命令行命令适用于第一部分。实际发起 pull request 的第二部分则完全在 Github 网站上完成。
$ git clone https://github.com/tim-peterson/dwolla-php.git
$ cd dwolla-php
$ git remote add upstream https://github.com/Dwolla/dwolla-php.git
$ git fetch upstream
// make your changes to this newly cloned, local repo
$ git add .
$ git commit -m '1st commit to dwolla'
$ git push origin master
第一部分: fork别人的仓库: https://help.github.com/articles/fork-a-repo
git clone->cd dwolla-php->git remote->git fetch
序列在电脑中的某个地方克隆你的fork(即将其复制/粘贴到, 在本例中: third_party TimPeterson$
) 并与主仓库(Dwolla/dwolla-php)同步git add->git commit->git push
序列将更改推送到远程仓库,即你在Github上的fork(tim-peterson/dwolla-php)第二部分: 发起pull请求: https://help.github.com/articles/using-pull-requests
Tims-MacBook-Pro:third_party TimPeterson$
,因为这是一份面向初学者的教程,这些提示可以帮助用户定位。 Translated: Tims-MacBook-Pro:third_party TimPeterson$
,因为这是一个针对初学者的教程,这些提示有助于帮助用户方向感。git fetch upstream
之后,难道不需要使用 git checkout master
然后 git merge upstream/master
将上游的更改与本地副本合并吗? - Sparhawk我开始了一个帮助人们进行第一次GitHub Pull Request的项目。您可以通过在此处完成入门教程来进行实践。
操作流程如下:
git clone <您之前复制的克隆URL>
git checkout -b 分支名称
git commit
git push origin 分支名称
Compare and pull request
按钮对于我们这些拥有github.com帐户,但在命令行中键入“git”时只收到错误消息的人,以下是如何在浏览器中完成所有操作的方法 :)
我按照Tim Peterson的指示进行操作,但是我为我的更改创建了一个本地分支。然而,在推送后,我在GitHub上看不到新的分支。解决方法是在推送命令中添加“-u”:
git push -u origin <branch>
tim-peterson
,第二个是Dwolla
。 - tim petersongithub-make-pr-branch ssh your-github-username orig_repo_user orig_repo_name new-feature
最简单的GitHub Pull Request是通过Web界面而不使用git。
点击铅笔图标,
在位置附近搜索文本,进行任何编辑,然后预览以确认。给建议的更改添加一个长达50个字符的描述和可选的扩展描述,然后单击Propose file Change按钮。
如果您正在阅读此内容,则无法对存储库(项目文件夹)进行写入访问,因此GitHub将在您的帐户中创建存储库的副本(实际上是一个分支)。单击Create pull request按钮。