Change previous commits messages while keep them signed-off

376 views Asked by At

I have a bunch of signed-off and pushed commits. I want to change their messages. However, when I do so with commands such as: git rebase -i HEAD~12 and reword their signatures disappear (I check it with git log --show-signature). How to change commits messages while keeping them signed-off?

2

There are 2 answers

1
techkuz On BEST ANSWER

There is no way to keep the old signatures while changing (e.g. its messages) the commits.

One way to change messages and sign-off again (creating new commits and substituting the old ones) is:

git rebase -i -S HEAD~12

1
Saeed On

You can sign them off again using this command:

git commit --amend --signoff

For multiple commits:

git filter-branch -f --commit-filter 'git commit-tree -S "$@"' HEAD
git push -f