I managed to sign a whole bunch of commits with the wrong id, and I wanted to preserve the commit and author date

these two commands do the same and sign each commit with the id specified in the local .git/config or the global ~one

git rebase -i --root --committer-date-is-author-date --exec 'GIT_COMMITTER_DATE=$(git log -1 --format=%cd) GIT_AUTHOR_DATE=$(git log -1 --format=%ad) git commit --amend --no-edit --reset-author -S'

or

git rebase -i --root --committer-date-is-author-date --exec 'GIT_COMMITTER_DATE=$(git log -1 --format=%cd) git commit --amend --date="$(git log -1 --format=%ad)" --no-edit --reset-author -S'

the rebase flag --committer-date-is-author-date works in tandem with the environment variables in the exec commit

if i only rebase one commit a time eg. HEAD~1, then I can omit the --committer-date-is-author-date

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mathstodon.xyz/users/v4rd4453n/statuses/115754220823575129 on your instance and quote it. (Note that quoting is not supported in Mastodon.)