Skip to content

Instantly share code, notes, and snippets.

@qdequele
Created February 24, 2018 10:33
Show Gist options
  • Save qdequele/490e413f82ab16e640510c180bb99b5b to your computer and use it in GitHub Desktop.
Save qdequele/490e413f82ab16e640510c180bb99b5b to your computer and use it in GitHub Desktop.
Resign all my old commits with GPG key
#!/bin/sh
cd $1
git filter-branch --commit-filter '
if [ "$GIT_COMMITTER_EMAIL" = "your@email.com" ]
then
git commit-tree -S "$@";
fi
' -- --all
git push origin master --force
@themattgabriel
Copy link

Thank you for sharing this!

Copy link

ghost commented Mar 29, 2021

Thank you.

@pcdro
Copy link

pcdro commented Apr 14, 2021

This is useful, but I needed something different. Resign my old commits from a branch from master, based on this I used the following:

git rebase --exec 'git commit --amend --no-edit -n -S' -i master
git push -f

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