Mark Bolusmjak
Mark Bolusmjak

Reputation: 24409

How to fix a pull request after git merge, amend, push?

There was a pull request into master on github.

I merged the pull request on the command line. Noticed a small issue, so fixed it it place, did a
git commit --amend
and pushed master.

Bad idea.

Now github doesn't recognize that the pull request has been merged.

How can I make it seem like that amend occurred on the branch to be merged, and hence that the merge took place? Or is there a better strategy to fix this?

Upvotes: 3

Views: 785

Answers (2)

Marcelo Boeira
Marcelo Boeira

Reputation: 880

  1. Delete the local branch
  2. Create a new one from master with the same name
  3. Push force it to the original pull request location
  4. Chill out

Upvotes: 0

Chris Beck
Chris Beck

Reputation: 16214

If you aren't willing to force push to rewrite history, then there's nothing you can do. IMO you should simply close the pull request in the github interface and perhaps leave a comment that you merged it.

An alternative is that you could try merging it again and if that results in a non-trivial commit then push that, maybe github will pick it up. But it's messy.

There are many projects where pull requests are literally never merged, for instance, many homebrew PRs are not merged, they are instead squashed into a single commit, reformatted by a homebrew developer and the modified version is merged, and then they close the original. This is not a bad practice.

Upvotes: 1

Related Questions