我已经在一个Git仓库上工作了一段时间并进行了一些提交。我一直在我的PHP文件中使用文档块,包括我的私人电子邮件地址,就像这样:
/**
* Bla bla bla.
*
* @author: Nic <foo@bar.com>
*/
现在我已经创建了一个新的电子邮件地址并更新了文档块,将旧地址替换为新地址。但是此更改仅适用于我更改文档后的提交。
我如何完全从git历史记录中删除旧电子邮件地址并将所有实例替换为新地址?
我尝试使用git filter-branch,使用这篇博客文章,但没有成功。 我得到以下结果:
git filter-branch --tree-filter 'git ls-files -z "*.php" |xargs -0 perl -p -i -e "s#old-email@example.com#new-email@foobar.com#g"' -- --all
Usage: git core\git-filter-branch [--env-filter <command>] [--tree-filter <command>]
[--index-filter <command>] [--parent-filter <command>]
[--msg-filter <command>] [--commit-filter <command>]
[--tag-name-filter <command>] [--subdirectory-filter <directory>]
[--original <namespace>] [-d <directory>] [-f | --force]
[<rev-list options>...]
可能是电子邮件地址中的特殊字符(@和.)在影响正则表达式吗?除此之外,我不知道出了什么问题,感谢任何帮助!