What happens if you forcefully push a branch with an existing pull request?

I am working on a git branch, which is currently part of a closed pull request on github. Subsequently, to the initial pull request, I made some additional commits, pushed these commits to github, and then returned these commits and confirmed them because I need to revise the commits.

Now, if I want to push these commits to github, I will need to call force push: git push --force . But I have a strong feeling that this can cause chaos with the existing pull request, even if the modified fixes occurred after they existed before I made the pull request.

Can someone describe to me how best to deal with this situation? I think I might just need to create a completely new branch, and then issue a transfer request to this branch. But if there is a way to relate this to an existing tensile request, which would be preferable.

+7
git github pull-request
source share
3 answers

If my memory serves me correctly, then if you forcefully push or update the branch of interest, GitHub will automatically update the transfer request. If clicking on the power device makes it impossible to request traction, GitHub will notify you of this.

You do not need to worry about updating the pull request, as GitHub will take care of this for you.

Saying this, running git push --force on any remote branch can cause chaos for your colleagues who also work on that branch. So you are right to dodge a power push, but luckily requesting a GitHub is not your biggest problem.

+6
source share

The contents of the stretch request will be in the branch that is sent for the pull request. Therefore, when you git push --force , PR will reflect your revised commit history in the branch you just clicked on.

+1
source share

Clicking on a branch with an existing transfer request will update the transfer request, it does not matter that the commits were executed after the pull request.

If you do not want to modify the transfer request, you must create a new branch and work on it.

+1
source share

All Articles