[英]How to update a pull request from forked repo?
So I first forked a repo and then made a commit to that forked repo. 所以我首先分叉了一个回购,然后提交了一个分叉的回购。 I then opened a pull request. 然后我打开了拉取请求。 The pull request listed all the changes I wanted. pull请求列出了我想要的所有更改。
After reviewing my pull request, there were a number of changes that the repo owner wanted me to make before he accepted it. 在审核了我的拉取请求之后,回购所有者希望我在接受之前做出一些更改。 I have made those changes in my fork, now how do I update the pull request with those changes (or is this not how I should handle it)? 我已经在我的fork中进行了这些更改,现在如何使用这些更改更新pull请求(或者这不是我应该如何处理它)?
You have done it correctly. 你做得对了。 The pull request will automatically update. 拉取请求将自动更新。 The process is: 过程是:
The pull request will automatically add the new commits at the bottom of the pull request discussion (ie, it's already there, scroll down! ) pull请求将自动在pull请求讨论的底部添加新提交(即, 它已经存在,向下滚动! )
Updating a pull request in GitHub is as easy as committing the wanted changes into existing branch (that was used with pull request), but often it is also wanted to squash the changes into single commit: 在GitHub中更新pull请求就像将所需的更改提交到现有分支(与pull请求一起使用)一样简单,但通常也需要将更改压缩到单个提交中:
git checkout yourbranch
git rebase -i origin/master
# Edit command names accordingly
pick 1fc6c95 My pull request
squash 6b2481b Hack hack - will be discarded
squash dd1475d Also discarded
git push -f origin yourbranch
...and now the pull request contains only one commit. ...现在,pull请求只包含一个提交。
Related links about rebasing: 关于变基的相关链接:
Just push to the branch that the pull request references. 只需按下pull请求引用的分支即可。 As long as the pull request is still open, it should get updated with any added commits automatically. 只要拉取请求仍然打开,它应该自动更新任何添加的提交。
I did it using below steps: 我用以下步骤做到了:
git reset --hard <commit key of the pull request>
git add
git commit --amend
git push -f origin <name of the remote branch of pull request>
If using GitHub on Windows : 如果在Windows上使用GitHub :
This is why, before you start making changes of your own, that you should create a branch for each set of changes you plan to put into a pull request. 这就是为什么在开始更改自己的更改之前,应该为计划放入拉取请求的每组更改创建一个分支。 That way, once you make the pull request, you can then make another branch and continue work on some other task/feature/bugfix without affecting the previous pull request. 这样,一旦你发出了拉取请求,你就可以创建另一个分支并继续处理其他任务/功能/ bug修复,而不会影响之前的拉取请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.