Is there any way to censor certain worDs from git commit messages from the commit history? Not from files or actual code, but from the commit messages themselves.
You can use filter-repo
tool's message callback to replace words in your commit messages
git-filter-repo --message-callback 'return re.sub(b"word",b"<redacted>",message)'
This will replace word
with <redacted>
in all your commit messages.
filter-repo
tool is not bundled with git, so you need to install it separately.
Using filter-branch
as mentioned in this answer:
git filter-branch --msg-filter 'sed "s/word/<redacted>/g"' -- --all