Original Source : https://stackoverflow.com/a/63884006
Warning : I will not be responsible for any data loss. This snippet marks all commits as verified but changes commit time & date as well as the original commit hash.
Impact : Commit linked to any issue will show error + everything will be recommitted hence same date, time and changed hash.
Result : Proceed with caution.
Run the following command :
git rebase --signoff -S HEAD~2
Replace HEAD~2 with Hash of the last commit from which you wish to sign all commits. Run git push -f
to apply changes.
Now all your previous unverified commits should be verified :) although the time and date of commits will change from previous values to same. Original commit hash will be replaced by new ones.