Sign-off multiple previous GIT commits
Working for libvirt
I had to add the Developer Certificate of Origin to several previous commits, where I forgot to directly use git commit --signoff
.
StackOverflow has that question, but it started missing -s
for --signoff
with -S
for --gpg-sign
.
At the end I used the following so sign the last 89 commits:
git config trailer.sign.key 'Signed-off-by'
SIGNOFF="sign: $(git config --get user.name) <$(git config --get user.email)>"
git filter-branch \
--force \
--msg-filter "git interpret-trailers --trailer '$SIGNOFF'" \
@~89..@
See GIT filter-branch for other use cases of git filter-branch
.
Only to find out that is as simple as
git rebase --signoff @~89
Written on July 22, 2020