Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I correct a pull request?

I did some changes to a forked repo on Github and sent in a pull request. The owner had some small issues I have fixed now locally. How should I submit these fixes? When I just make a commit and push, will there be one more "fixed" commit within the pull request?

To keep it clean, I would like to rebase or amend my last commit and do a forced push, but what would happen then with the pull request? Will it be deleted automatically or just added (what I would like to happen)?

like image 627
Asara Avatar asked Mar 31 '18 14:03

Asara


People also ask

How do you fix a pull request?

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.

How do I edit a pull request after review?

To edit a pull request, you push new changes into the same branch that was used for the pull request. Github will update everything else automatically.

Can you redo a pull request?

While you can't undo a pull request, you can revert the merged commit from a pull request if necessary.


1 Answers

A pull request is made from the reference of a branch (and not from a particular commit).

So, every change you make in the branch (that is pushed to your repository) until the pull request is merged will be reflected in the pull request.

That's a clear design made by GitHub to make contribution easier, with commits that could be added following reviews and comments. That's even a recommended workflow to open the pull request early in the development (i.e. when the work is not finished) to start early reviews or discuss about some code (the draft mode of a PR is for that).

There is no problem to amend a commit and do a --force-with-lease (that should be preferred to --force) since you are sure that you are the only one working in this branch, or you warn other developers beforehand or they know perfectly well how to handle the update (otherwise you will really bother the other developers)

like image 59
Philippe Avatar answered Sep 25 '22 09:09

Philippe