Pushing a Commit to an Existing PR
To push a commit directly to a PR created by someone else:
info
Before following the instructions given on this page, ensure that the PR has enabled Allow edits from maintainers
.
Check out the PR using
gh
:gh pr checkout <pr-url>
Make your changes locally.
Commit your changes:
git commit -am "commit-message"
Add the PR owner's repo as remote:
git remote add <pr-owner> https://github.com/pr-owner/repo-name.git
Fetch its current content:
git fetch <pr-owner>
Push your commit to the branch:
git push <pr-owner> <branch-name>
After this, you can go back to the PR's page on GitHub and refresh the page. You should find the commit you just pushed.