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?
Asked
Active
Viewed 297 times
0

techkuz
- 3,608
- 5
- 34
- 62
2 Answers
1
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

Saeed
- 2,169
- 2
- 13
- 29
-
use filter-branch for multiple commits. updated the answer – Saeed Aug 26 '18 at 07:53
0
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

techkuz
- 3,608
- 5
- 34
- 62
-
This is because you literally *can't* change a commit. You can only make a *new* commit that you start using instead of the old one. So you must sign the new commit. – torek Aug 26 '18 at 17:02