Multi-user Github Pull Requests

前端 未结 6 2009
深忆病人
深忆病人 2020-12-25 11:48

Is it possible to amend a pull request that someone else has started?

Assume I maintain project X, and User A has sent me a pull request. There\'s some things I wan

相关标签:
6条回答
  • 2020-12-25 12:31

    Assuming you have read and write access to the user's github repository you can push to the branch that the pull request is coming from.

    It's on the bottom of the pull request before the MERGE PULL REQUEST button.

    You can add more commits to this pull request by pushing to the XXXXX branch on yyyy/zzzzz

    0 讨论(0)
  • 2020-12-25 12:40

    Unfortunately, no, the following does not work:

    git push -f upstream my-updates:refs/pull/999/head ... ! [remote rejected] my-updates -> refs/pull/999/head (deny updating a hidden ref) error: failed to push some refs ...

    0 讨论(0)
  • 2020-12-25 12:40

    It is possible! All you have to do it check out the branch that is in their pull request and make the changes you want. After you commit and push those changes they should be reflected in the pull request in Github.

    0 讨论(0)
  • 2020-12-25 12:50

    You can do it like this:

    In your repo,

    git checkout -b new-branch
    

    Then pull User A's commits into your new-branch:

    git pull git://github.com/[User A]/[project-name].git
    

    After that, you can change it whatever you like in the new-branch. And when you test and satisfy with your changes, you can merge it into your master branch:

    git checkout master
    git merge new-branch
    

    OK, now you have your code with User A and your changes.

    0 讨论(0)
  • 2020-12-25 12:54

    Not possible, but you can submit a second pull request to their branch, which would update the original pull request if they decide to merge it.

    0 讨论(0)
  • 2020-12-25 12:55

    I realize this is an old question, but GitHub has recently introduced some new features that make it possible to actually update a pull request submitted by another user.

    When you are creating a new pull request, you'll see a checkbox labelled "Allow edits from maintainers". This is enabled by default.

    With this in place, anyone with commit access to the repository that is the target of your pull request will also be able to push changes to the branch of your repository that is the origin of the pull request.

    This is especially use in team environments in which everyone has commit access to the "main" repository, but all work is done on feature branches in individual forks. It means that if there is an open pull request that needs some changes and the primary author is unavailable, someone else on the team can make the necessary updates directly, rather than closing the existing PR and opening a new one.

    0 讨论(0)
提交回复
热议问题