I asked the following questions to support @ Github.
We squash our commits before merging the branch but I face a couple of problems.
First is if I squash commits through the Github UI, even though all individual commits are GPG verified the squashed commit isn’t.
Second, even if I squash the commits from another branch(feature) to get a verified commit, commit them to say develop and push to develop then Github still shows the PR as open. It should automatically show the PR as merged.
This leads to a very poor experience where I can’t use the squash option on Github UI and have to manually close the PR after squashed merging.
And got back the following reply
Hi Pawan,
Thanks for getting in touch and providing feedback about signed commits and pull requests.
When squashing commits using the GitHub UI, the new commit that is created cannot be signed. Even though you have triggered the commit’s creation, it’s not created on your computer and thus we can’t sign the commit on your behalf. We are looking into ways of making commits created via the GitHub UI signed as well, but we don’t have any information to share right now.
If you’re merging pull requests by merging branches in a local clone, then the base branch needs to contain all the commits from the head branch in order for us to be able to detect that the head was merged into the base. If you do a squash-merge in your local clone, then the base contains a new commit instead of the commits on the head branch, so we can’t do that detection currently (since the detection is based on commits, not diffs). When you squash-merge using the web UI – we know which pull request is involved and can mark it as merged. In other words, if you’re merging pull requests in a local clone – you’ll currently need to use merge commits instead of squash-merges if you want pull request to be automatically closed and marked as merged. We might change that behaviours in the future, but I can’t say when that might happen.
I hope this explains the behaviour you observed. We are always looking to create the best experience possible, so I’ve noted your feedback on our Internal Feature Request list. This will allow us to review your experience and see if there is any way of improving it.
We can’t say if/when we may be able to improve this process, however your feedback has definitely been recorded.
Thanks,
Alex
Now that I think about it, first one seems pretty obvious now. Understood something new in the second one. I thought some of us may have the same doubt, so wanted to share this.