1、永久删除git库中的大文件
例如删除csv3000.zip
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch csv3000.zip' --prune-empty --tag-name-filter cat -- --all
如果commit已经同步到了github,那么再运行如下命令永久删除远端上的文件。
git push --all --force
==注意,gitlab默认有分支保护,不允许这个操作(remote: GitLab: You are not allowed to force push code to a protected branch on this project.)。创建者可以在setting页面中临时去掉保护。
重新clone,就会发现没有这个文件了
2、git回退到远程主分支
git reset --hard origin/master