修改git log的文字说明内容
命令:
git filter-branch -f --msg-filter 'sed "s/旧的文字/新替换的文字/g"' -- --all
-- --all表示全分支修改
例子:
$ git log
commit 53d7f2298f510a561730193fe516513d48868053 (HEAD -> master)
Author: 123 <111@111.com.cn>
Date: Fri Nov 18 15:55:25 2022 +0800
增加了新文件A
$ git filter-branch -f --msg-filter 'sed "s/增加了新文件A/add 新文件A/g"' -- --all
WARNING: git-filter-branch has a glut of gotchas generating mangled history
rewrites. Hit Ctrl-C before proceeding to abort, then use an
alternative filtering tool such as 'git filter-repo'
(https://github.com/newren/git-filter-repo/) instead. See the
filter-branch manual page for more details; to squelch this warning,
set FILTER_BRANCH_SQUELCH_WARNING=1.
Proceeding with filter-branch...
Rewrite 53d7f2298f510a561730193fe516513d48868053 (1/1) (0 seconds passed, remaining 0 predicted)
Ref 'refs/heads/master' was rewritten
$ git log
commit ff27d7841cb0d362f27fc48b5b187ee3f5ec7a6c (HEAD -> master)
Author: 123 <111@111.com.cn>
Date: Fri Nov 18 15:55:25 2022 +0800
add 新文件A