开发者

Rewriting Git History: How do I remove a sign-off?

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 onl开发者_运维问答y 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜