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 want changed before merging and can quickly do them myself. How can I do this simply and keep it all within one PR?
Is this even possible?
With pull requests you can invite other people to review your work and give you feedback. Once a pull request is open, you can discuss your code with other developers.
By default, any pull request can be merged at any time, unless the head branch is in conflict with the base branch. But as your project matures and stabilizes, you can choose to enforce restrictions on how a pull request is merged into your repository.
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.
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.
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
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 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With