对特定提交使用 git filter-branch

Spa*_*323 5 git github

我正在尝试使用 gitfilter-branch功能删除最近更新和提交的文件。我尝试运行以下命令:

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch myfile' --prune-empty --tag-name-filter cat -- 6f7fda9..HEAD
Run Code Online (Sandbox Code Playgroud)

但是,这只会从主分支中删除文件,我希望将其从所有分支中删除。

与承诺开始6f7fda9HEAD我要删除的文件。我运行的命令是错误的吗?

phd*_*phd 1

git filter-branch -- --all在所有分支上运行过滤器。所以:

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch myfile' --prune-empty --tag-name-filter cat -- --all
Run Code Online (Sandbox Code Playgroud)