I recently had to slightly modify the code in a Pull Request that another user submitted to one of my projects on GitHub.
Of course one can comment and suggest a change if one is not satisfied with the request but it was a small change and I had time so I decided to fix it myself.
To my surprise GitHub is surprisingly low on details in how to add a commit to an existing Pull Request of another user and I did not find a 100% satisfactory answer on how to do it the right way, so here is how I did it (I don’t know if this is the git-greybeard approved way but it worked for me).
Quick recap: User
Alice forked User
MyRepo and created a branch
fix-branch in which she committed her changes.
Alice has submitted a Pull Request to
Bob now wants to add a commit to her Pull Request before merging it.
create a new remote for
git remote add Alice email@example.com/Alice/MyRepo.git
git fetch Alice
git checkout Alice/fix-branch
make your changes and commit them:
git add . git commit -m "YOUR MESSAGE"
push the changes to
git push -u Alice HEAD:fix-branch
Your commits should now appear in
Alice’s PR and you can merge it.
This only works if the other user has allowed the owner of the repository to push to their fork. This is the default setting though, so it should work in most cases.