Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multi-user Github Pull Requests

Tags:

git

github

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?

like image 845
Neil Middleton Avatar asked Nov 27 '12 20:11

Neil Middleton


People also ask

Can multiple people work on a pull request?

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.

Can collaborator merge pull request GitHub?

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.


4 Answers

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.

like image 91
oppih Avatar answered Oct 24 '22 02:10

oppih


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.

like image 35
larsks Avatar answered Oct 24 '22 02:10

larsks


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

like image 3
sjakubowski Avatar answered Oct 24 '22 03:10

sjakubowski


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 ...

like image 1
cdunn2001 Avatar answered Oct 24 '22 03:10

cdunn2001