When rewriting a Git repository's history, how do you remove sign-offs (as created by git commit -s or git commit --signoff)?
git filter-branch's commit-filter seems to only support the variables used by git commit-tree:
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL
GIT_AUTHOR_DATE
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL
GIT_COMMITTER_DATE
EMAIL
Sign offs are just part of the message body. So, you'll want to use git filter-branch --msg-filter to run a command to find lines starting with Signed-off-by: and remove them.
Something like
git filter-branch --msg-filter "sed /^Signed-off-by:/d"
should do the trick.
For deleting all sign-offs or all sign-offs by a particular person / e-mail address, see Brian's answer.
Based on the information Brian provided (i.e. that sign-offs are part of the commit message), it was easy to figure out how to delete or change individual sign-offs:
Run an interactive rebase (git rebase -i) on the parent of the commit that has the sign-off, find the commit in the editor that pops up and replace pick with reword. In the editor that shows up next, adjust the commit's message to your liking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With