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.

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)?


You have done it correctly. The pull request will automatically update. The process is:

  • Open pull request
  • Commit changes based on feedback in your local repo
  • Push to the relevant branch of your fork
  • The pull request will automatically add the new commits at the bottom of the pull request discussion (ie, it's already there, scroll down! )


    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:

    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.


    Related links about rebasing:

  • https://help.github.com/articles/about-git-rebase
  • Squash all my commits into one for GitHub pull request

  • Just push to the branch that the pull request references. As long as the pull request is still open, it should get updated with any added commits automatically.

    链接地址: http://www.djcxy.com/p/2982.html

    上一篇: 按值python排序字​​典

    下一篇: 如何更新分叉回购的请求?