如何git甚至从提交历史中完全删除文件?

如何git甚至从提交历史中完全删除文件?,git,large-files,Git,Large Files,我承诺删除一个大文件。现在我想从本地.git中取出这个大文件。需要遵循哪些步骤才能奏效 我试过: git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch$files" HEAD 还有这个 git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch $file' --prune-empty --tag-name-fil

我承诺删除一个大文件。现在我想从本地
.git
中取出这个大文件。需要遵循哪些步骤才能奏效

我试过:

git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch$files" HEAD
还有这个

git filter-branch --force --index-filter  'git rm --cached --ignore-unmatch $file'  --prune-empty --tag-name-filter cat -- --all

您正在寻找的神奇git命令是,它允许您编辑git repo。示例部分的第一个示例是:

   Suppose you want to remove a file (containing confidential information
   or copyright violation) from all commits:

       git filter-branch --tree-filter 'rm filename' HEAD

无法创建新备份。refs/original/Force中已经存在一个以前的备份,因为该参数正在强制执行该操作,因此使用-fAdd'-f'覆盖备份,因此:
git filter branch-f--tree filter'rm filename'HEAD
命令
git filter branch--force--index filter'git rm--cached--ignore unmatch$Rakefile'--prune empty--tag name filter cat--all
对我很有效。位于repo根目录和$Rakefile,包括要删除的文件的相对路径<代码>linux,git版本2.6.4。