The current way to update a pull request is to click on the “Edit” button along the other pull request action buttons. This will bring you to the update pull request page where you can make changes to the title, description, reviewers and specify whether to close the branch after the pull request has been merged.
To edit a pull request, select the pull request on the Pull requests page, go to its detail page and click "Edit". The target branch (the base branch) and the pull request branch (the branch that will be merged) cannot be changed.
The pull request will be updated with the new commit contents. You can do that either by specifying the -f option when you run git push or putting a plus sign ( + ) in front of the branch name when pushing. Usually your CI system will realize that your commits have changed and run again on the new commits.
Just push more commits on to the branch the request is for. The pull request will pick this up then.
If you want to have b merged into master
I just had one commit in a pull request, and I used git commit --amend
to update it. I then did a force push with git push -f
so my amended commit replaced the original one. The pull request automatically picked up the new commit. (It actually showed both commits, but when I reloaded the page the old commit had gone.)
So while a forced push is generally not recommended, it can be useful for pull requests. It's not recommended because if someone bases a commit on top of yours then they will have to do a rebase after your change. But since nobody should be basing their work on an under-review pull request, it should be pretty safe in this situation.
If you continue to make changes and keep pushing to the same branch, the refined commits will be added to the same pull request (unless your pull request has been merged). This could make the history very cluttered.
An alternate solution and a technique that I use is as follows:
Create a new branch (fixes) from the repository(upstream) and branch (develop) to which you intend to send the pull request by doing:
git branch fixes upstream/develop
Add your refined commits directly to this newly created branch.
git commit -m "your message"
Push this branch to your own forked remote (could be named origin).
You also can use github api.
curl --user "your_github_username" \
--request PATCH \
--data '{"title":"newtitle","body":"newbody",...}' \
https://api.github.com/repos/:owner/:repo/pulls/:number
you can find the detailled list of data in github developer doc
curl --user "jeremyclement" \
--request PATCH \
--data '{"title":"allows the control of files and folders permissions."}' \
https://api.github.com/repos/Gregwar/Cache/pulls/9
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With