Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How squash and merge a Pull Request with GPG signing via command line?

https://help.github.com/articles/about-pull-request-merges/#squash-and-merge-your-pull-request-commits

Is there way to squash and merge a Pull Request with my GPG signing via command line? Merging a Pull Request on UI doesn't supports GPG signing. I've tried to merge via git merge --squash, but it doesn't close the Pull Request automatically.

like image 442
okuryu Avatar asked Apr 17 '18 13:04

okuryu


People also ask

How do you squash commits on a pull request?

Pull requests with squashed commits are merged using the fast-forward option. To squash and merge pull requests, you must have write permissions in the repository, and the repository must allow squash merging. You can use squash and merge to create a more streamlined Git history in your repository.

How do I accept a pull request and merge?

To accept the pull request, click the Pull Requests tab to see a summary of pending pull requests. If you are happy with the changes, click Merge Pull request to accept the pull request and perform the merge. You can add in a comment if you want. Once you click Merge Pull request, you will see a button Confirm merge.

Does squash and merge create a merge commit?

Squash merging is a merge option that allows you to condense the Git history of topic branches when you complete a pull request. Instead of each commit on the topic branch being added to the history of the default branch, a squash merge adds all the file changes to a single new commit on the default branch.


1 Answers

The "Squash and merge your pull request commits" is a server-side option which, indeed, does not support gpg signing.

That means you need to:

  • fetch the pull request in a local clone
  • git merge --squash, with the --gpg-sign option
  • push the new merge commit
  • use the GitHub API to update the Pull Request state or manually close the pull request.

It is a manual and somewhat convoluted process, but it will work.

like image 59
VonC Avatar answered Oct 18 '22 17:10

VonC