⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

@andyblundell
Copy link
Contributor

We already have instructions to retrospectively sign commits. This change adds a fewer-steps-but-less-flexible variation to bulk-sign the most recent N commits in one go.

@andyblundell andyblundell requested a review from a team as a code owner February 10, 2026 15:17
@sonarqubecloud
Copy link


```bash
git rebase --exec "git commit -S --amend --no-edit --allow-empty" HEAD~10
git push -f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth considering using the safer long flag option git push --force-with-lease rather than -f

If N == 10:

```bash
git rebase --exec "git commit -S --amend --no-edit --allow-empty" HEAD~10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible alternative:

git rebase --exec 'git commit --amend --no-edit -n -S' $(git log --format='%H %G?' main..HEAD | grep ' N$' | tail -1 | cut -d' ' -f1)^

It's a bit wordy but it finds the first unsigned commit between main and HEAD and signs that and everything since. Avoids needing to figure out N, but relies on gpg.ssh.allowedSignersFile being configured if you're using SSH signing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants