【发布时间】:2018-01-16 01:29:56
【问题描述】:
我有一个实验项目正在进行中,由于我只在本地使用它,我添加了敏感数据(秘密和连接字符串)。我现在想在远程推送 repo 之前从 git 历史记录中清除这些数据。我一直在尝试关注 github guide 来执行此操作,并尝试运行此命令:
git filter-branch --index-filter \"git rm --cached --ignore-unmatch C:\Users\George\Source\Repos\myExperimentalProj\server\config.ts" \ --prune-empty - -tag-name-filter cat -- --all
我也试过了-
git filter-branch --index-filter \"git rm --cached --ignore-unmatch .\server\config.ts" \ --prune-empty --tag-name-filter cat -- --全部
但是我总是得到这个错误:
fatal: ambiguous argument 'rm': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
我正在使用带有 git version 2.8.1.windows.1 的 Windows 命令提示符。
我做错了什么?
【问题讨论】:
-
据我了解,参考指南中的
\用于转义换行符(作为续行符),但您没有在\之后放置换行符。