我如何创建和/或发送一个拉请求到另一个存储库托管在GitHub?
当前回答
为了学习如何做出拉请求,我只是跟随了Github上的两个独立的帮助页面(下面链接为项目符号)。下面的命令行命令用于第1部分。第2部分,实际的拉请求,完全在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
Part 1: fork someone's repo: https://help.github.com/articles/fork-a-repo click the 'fork' button on the repo you want to contribute to, in this case: Dwolla's PHP repo (Dwolla/dwolla-php) get the URL for your newly created fork, in this case: https://github.com/tim-peterson/dwolla-php.git (tim-peterson/dwolla-php) type the git clone->cd dwolla-php->git remote->git fetch sequence above to clone your fork somewhere in your computer (i.e., "copy/paste" it to, in this case: third_party TimPeterson$) and sync it with the master repo (Dwolla/dwolla-php) make your changes to your local repo type the git add->git commit->git push sequence above to push your changes to the remote repo, i.e., your fork on Github (tim-peterson/dwolla-php) Part 2: make pull-request: https://help.github.com/articles/using-pull-requests go to your fork's webpage on Github (https://github.com/tim-peterson/dwolla-php) click 'pull-request' button give pull-request a name, fill in details of what changes you made, click submit button. you're done!!
其他回答
对于我们这些拥有github.com帐户的人来说,当我们在命令行中输入“git”时,只会得到一个讨厌的错误消息,下面是如何在你的浏览器中完成这一切:)
Same as Tim and Farhan wrote: Fork your own copy of the project: After a few seconds, you'll be redirected to your own forked copy of the project: Navigate to the file(s) you need to change and click "Edit this file" in the toolbar: After editing, write a few words describing the changes and then "Commit changes", just as well to the master branch (since this is only your own copy and not the "main" project). Repeat steps 3 and 4 for all files you need to edit, and then go back to the root of your copy of the project. There, click the green "Compare, review..." button: Finally, click "Create pull request" ..and then "Create pull request" again after you've double-checked your request's heading and description:
我已经启动了一个项目来帮助人们进行他们的第一个GitHub拉请求。你可以在这里通过实践教程来制作你的第一个PR
工作流程简单如
Fork的回购在github 通过点击克隆回购按钮获得克隆url 打开终端,运行git clone <clone url你之前复制的> 为你所做的更改创建一个分支git checkout -b branch-name 做出必要的改变 git Commit提交你的更改 在GitHub上将你的更改推送到你的fork上git Push origin branch-name 去你的GitHub上的分叉看到一个比较和拉请求按钮 点击它并给出必要的细节
为了进行pull请求,您需要执行以下步骤:
Fork a repository (to which you want to make a pull request). Just click the fork button the the repository page and you will have a separate github repository preceded with your github username. Clone the repository to your local machine. The Github software that you installed on your local machine can do this for you. Click the clone button beside the repository name. Make local changes/commits to the files sync the changes go to your github forked repository and click the "Compare & Review" green button besides the branch button. (The button has icon - no text) A new page will open showing your changes and then click the pull request link, that will send the request to the original owner of the repository you forked.
我花了一段时间才弄明白,希望这能帮助到一些人。
我遵循蒂姆·彼得森的指示,但我为我的更改创建了一个本地分支。然而,在推动后,我没有看到在GitHub的新分支。解决方案是在push命令中添加-u:
git push -u origin <branch>
我写了一个bash程序,它为您完成了所有建立公关分支的工作。如果需要,它会执行分叉,与上游同步,设置上游远程等,你只需要提交你的修改,推送和提交PR。
下面是你如何运行它:
github-make-pr-branch ssh your-github-username orig_repo_user orig_repo_name new-feature
你可以在这里找到这个程序,如果你想了解它是如何工作的,它的存储库还包括手动执行相同过程的逐步指南,以及关于如何使用上游主程序和其他有用的花絮来保持你的特性分支的最新信息。
推荐文章
- git可以自动在空格和制表符之间切换吗?
- Git暂存文件列表
- 在Markdown Jekyll中使用图像说明
- 如何将git配置存储为存储库的一部分?
- 如何修改GitHub拉请求?
- 如何在Github和本地删除最后n次提交?
- 我如何调试git/git-shell相关的问题?
- 错误:无法使用rebase进行拉取:您有未分阶段的更改
- Git隐藏未缓存:如何把所有未分期的变化?
- 如何将文件附加到GitHub问题?
- 真实的恶魔
- 如何从另一个分支获得更改
- Git:权限被拒绝(publickey)致命-无法从远程存储库读取。克隆Git存储库时
- git reflog和log有什么区别?
- git推挂在Total line之后