Reputation: 4080
I could just copy the code and make a new PR with the added docs etc. but then I would get all the credit for the code.
How do I do it the right way?
Upvotes: 3
Views: 438
Reputation: 42160
Another option that I've used myself before when in a similar situation is to edit the PR and change the base from master
to a temporary branch. Then merge the PR to the temporary branch, make whatever changes you need to and raise a new PR to merge into master
. This will retain the original commits by the contributor.
Another pattern is to merge to a temporary branch and then cherry pick commits by the contributor to a new branch or directly to master. Cherry picking also retains the contributor of the commit as the author. You (the collaborator) will be shown as the committer. The link below is an example commit showing what that looks like.
https://github.com/peter-evans/create-pull-request/commit/062968931cd601fdcb4b8b0a2e21b69e0ef43812
Upvotes: 1
Reputation: 31187
If you're a collaborator of the GitHub project, you have, by default, the rights to push directly commits to the branch that is used to do the pull request.
This is the settings enabled by default when you do a PR:
So, you have just to add a remote and push to it. Even if it's better to communicate about it (I did it some rare times and that completely loose some git beginners that have difficulties)
Or you could merge it and do the fix after.
Upvotes: 2