I received Pull Request in GitHub from contributor. But I'd like to make some changes to it. How to do that and still give him credit when merging?

77 views Asked by At

I received a Pull Request for my GitHub repo from a fellow contributor. But I would like to make some changes to it before merging. It is not clear to me how to do that and then still merge under his name to give him credit. I can only merge the whole thing as he submitted. What am I missing?

I would like to do that in the command-line (i.e. terminal) with the appropriate sequence of git commands. Thanks in advance for your help.

2

There are 2 answers

2
matt On

Fetch and check out the PR branch, and make and switch to a new branch. Make the desired changes and add and commit. Push. Make a PR asking to merge your new branch into the first PR branch. There are now two PRs that give credit where credit is due, and they can be merged in any order.

0
sfeldmann On

Just merge the changes into a work-in-progress branch. Switch to that branch locally, make the adjustments, push the branch and create a new pull request.

  1. Go to https://github.com/{YOUR_NAME}/{YOUR_REPO}/branches and hit the new branch button.

  2. Go to the open pull request page https://github.com/{YOUR_NAME}/{YOUR_REPO}/pull/{NUMBER} and hit edit button in the top right. Switch the target branch to the work-in-progress branch.

  3. Merge the pull request.

  4. Go to your local machine, update your repo git pull and switch to the work-in-progress branch.

  5. Make your changes and push them.

  6. Create another pull request for your work-in-progress branch and merge it.

You have merged all the contributed commits along with your changes.