我必须将所有 git repo 提交消息中的文本替换为另一个文本。 似乎可以使用 git rebase -i ... 来打开文本编辑器,但我必须自动执行此操作。 是否可以使用某些 git 命令或 Java 库来实现?
最佳答案
git filter-branch
是用于自动批量历史重写的工具。
具体--msg-filter
:
--msg-filter This is the filter for rewriting the commit messages. The argument is evaluated in the shell with the original commit message on standard input; its standard output is used as the new commit message.
就您而言,一个简单的 sed
作为命令可能就足够了。
关于git - 更改 Git 中的旧提交消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64495979/