Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to continue a pull request opened by someone else on Github?

In a repository which is not mine, a third person opened a pull request. One of the owners suggested some changes to make before being able to merge it. However, the author of the pull request has not done it, and it remains open for several months without the modificqtions have been implemented.

Actually I am refering to a situation like this one.

I would make myslef the requested improvements.

What is the cleanest and best way to do this? Can I add my commits at the following or do I need to open a new pull request?

like image 580
Delgan Avatar asked Nov 24 '15 19:11

Delgan


People also ask

Can a pull request be reopened?

You need the rights to reopen pull requests on the repository. The pull request hasn't been merged, just closed. Go to Pull requests add filter `is:closed` choose PR you want to reopen. Select from checkbox and mark as Open.

Can I commit to someone else's pull request?

We could review the pull request and ask for those changes, and that's often our strategy on internal projects. Isn't there an easier way? Can't you just add your own commits to someone else's pull request? Yes.

Can multiple people work on a pull request?

Once a pull request is open, you can discuss your code with other developers. Most Git hosting platforms allow other users to add comments and suggest changes during that process. After your reviewers have approved your work, it might be merged into another branch.


1 Answers

The only way to update a pull request is to push to the branch that's been PRed - so even the original repo's owner can't amend the PR, by default. It does make sense - for traceability's sake, at least.

So if you want to finish that work, the best thing you can do is to fork the original repo, clone it on your machine, add the PR's repo as a remote, checkout the PR'ed branch, commit on top of that, push those changes to your own fork, and make a new PR stating in the comments that it continues and fixes the other PR, so the original PR would get closed when yours' is merged.

In this case, something like:

$ # Go to https://github.com/cheeriojs/cheerio/ and fork it
$ git clone https://github.com/Delgan/cheerio/ && cd cheerio # assuming that's your GH username :)
$ git remote add pr-base https://github.com/digihaven/cheerio/
$ git fetch pr-base
$ git checkout pr-base/master -b 641-appendTo_prependTo
$ # work work work
$ git add #...
$ git commit -m 'Fixed all the things! See #641, fixes #726'
$ git push origin 641-appendTo_prependTo
$ # Go to your repo and make the PR
$ # ...
$ # SUCESS! (??!)
like image 93
mgarciaisaia Avatar answered Sep 24 '22 15:09

mgarciaisaia