瘦身过程如下:
1.复制两个最新版本
git clone ssh://git@host:port/project.git
dir1/project
dir2/project
2.对dir1目录的工程进行瘦身
删除所有非python文件以及其记录,并提交.
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch *.txt *.index *.meta ' --prune-empty --tag-name-filter cat -- --all
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
git push origin --force --all
3.gitlab需要取消强制提交保护
4.对比dir1/project和dir2/project,把所需非python文件复制回来,
再次提交
如此,即保证工程可用, .git目录大大减小, 提高部署速度.
注意:本文归作者所有,未经作者允许,不得转载