支付宝红包
京东盲盒抽奖
幸运转盘
秒杀
自营热卖
支付宝红包

.git目录瘦身

木子玺 1年前   阅读数 223 0

瘦身过程如下:
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目录大大减小, 提高部署速度.


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: