我想从本地 git 存储库中清理一个大文件(顺便清理我的存储库以减小大小)。这是我的狂欢:
#!/bin/bash
bigfile="/path_to_mygitproject/bigfile.tar.gz"
git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch '"$bigfile"'' --prune-empty --tag-name-filter cat -- --all
git filter-branch --force --index-filter 'git rm -r --cached --ignore-unmatch '"$bigfile"'' HEAD
Run Code Online (Sandbox Code Playgroud)
但现在显示以下警告:
WARNING: git-filter-branch has a glut of gotchas generating mangled history
rewrites. Hit Ctrl-C before proceeding to abort, then use an
alternative filtering tool such as 'git filter-repo'
(https://github.com/newren/git-filter-repo/) instead. See the
filter-branch manual page for more details; to squelch this warning,
set FILTER_BRANCH_SQUELCH_WARNING=1.
Run Code Online (Sandbox Code Playgroud)
我一直用这个bash,从来没有遇到过问题。到目前为止。我猜 git 中发生了一些变化。
我尝试将“git filter-branch”替换为“git …