When I develop in a branch and merge it into master with:
git merge --no-ff $BRANCH
git push origin HEAD
It merges the PR in Github (the purple badge).
But if I want to merge it squashed:
git merge --squash $BRANCH
git add . && git commit -m "Merge branch '$BRANCH'"
git push origin HEAD
It remains open til I remove the branch:
git branch -D $BRANCH
git push origin :$BRANCH
How can I merge a squashed branch and merge (not close) the PR in Github?
Here's an example repo: https://github.com/sospedra/better-pr-close
In case anyone has the same problem. I contacted the GitHub team by email and they tell me is not possible right now because they use the SHA's commit to link the merge commit with the PR.
Here's the full answer:
The logic to automatically merge a Pull Request looks at the commit SHA's present on the Pull Request.
If all of the commit SHA's have been pushed to the base branch already, we'll automatically mark it as merged.
When you squash commits and push, the references to the original commits are lost.
This means that is isn't currently possible to mark a PR as merged if the commits have been squashed and pushed from the command line.
I can pass your request onto the team to consider for future improvements.
I can't promise if or when we'd add this but I'll for sure pass it along!
They'll take the request into consideration. Hopefully will be added at some point.