1、重写commit,删除大文件**
git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch dns.zip" --prune-empty --tag-name-filter cat -- --all
dns.zip:文件名
2、如果报错了咋办?**
报错:Cannot rewrite branches: Your index contains uncommitted changes.
解决:git stash
3、如果没有报错,就一直等待清理完成,推送即可:**
git push origin master --force
如果报了第2步的错,就需要解决后重新执行:git filter-branch --force --index-filter "git rm -rf --cached --ignore-unmatch CPT_0707_ao/temp_past/temp2/deltap.csv" --prune-empty --tag-name-filter cat -- --all,等待修复完成后git push
4、清理和回收空间**
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
网友评论