Adding commits to another person's pull request on GitHub

十年热恋 提交于 2019-12-20 08:54:26

问题


My project on GitHub has received a pull request. The pull request only partly fixes the issue that it's addressing. I've pulled in the changes to a local branch and added some commits of my own.

I'd now like to push those commits back to my remote repo and have them show up on the pull request, but without merging them into the target branch. I'd like to keep the pull request open for further review and discussion, and potentially further commits.

Is there a way I can add commits to the pull request without merging them into the target branch and therefore closing the pull request?


回答1:


As long as the original author has clicked the checkbox in the bottom right:

If that box is checked, then you can push back to the original branch without needing to add a remote by using:

git push git@github.com:user/repo local_branch_name:remote_branch_name

This is particularly useful if you're using a tool like hub where you can check out a pull request without needing to add a remote.




回答2:


It is possible to do this now (link)

Suppose you have received a pull request in yourrepo from otheruser.

Add the other user as a remote

git remote add otheruser https://github.com/otheruser/yourrepo.git

Fetch

git fetch otheruser

Create a branch from their repo

git checkout -b otheruser-master otheruser/master 

Now make some changes and commit. Push to their repo

git push otheruser HEAD:master



回答3:


Not unless barryceelen gives you push access to his fork. You'll have to close his pull request and open a new one from your branch that includes his commits.

Not being able to do what you want to do is annoying. To make better use of GitHub flow, I'd suggest asking forkers to open issues separately from their pull requests that solve them, meaning you can keep the initial conversation flow and have it closed by whatever pull request you decide as the best.



来源:https://stackoverflow.com/questions/20928727/adding-commits-to-another-persons-pull-request-on-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!