如何使用模式更改10k提交消息

时间:2016-10-04 00:59:46

标签: git sed

我想在存储库中重写所有提交消息。存储库很大,提交量超过10k。我想将所有与以下某种模式匹配的文本替换为Issue

"(?i)conn-\d{1,4}[abcdi]"
"(?i)conn-\d{1,4}"
"(?i)connect-\d{1,4}"
"(?i)gateway-\d{1,4}[ab]"
"(?i)gateway-\d{1,4}"

我尝试使用"What's the fastest way to edit hundreds of Git commit messages?"的最佳答案但是使用git format-patch -10000然后编辑所有修补程序然后执行git am *.patch我遇到了大量错误error: file/name.txt does not not exist in index the file/name.txt

我知道我可以用git filter-branch -f --msg-filter "sed 's/<old>/<new>/'"做到这一点但是我如何能够一次性使用所有模式而不是每个模式一次?每次执行git filter-branch时,此过程需要1小时。所以我理想情况下只执行一次。

0 个答案:

没有答案