git大包文件,删除并重写? [英] git large pack file, delete and rewrite?

查看:98
本文介绍了git大包文件,删除并重写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个相对较小的git仓库,它是一个标准的wordpress安装。
但除此之外,我无意中在存储库中有一个概念文件夹,里面有很多更大的psd文件。

现在的问题是,在50提交,该git创建了一个包文件,这是1,3 GB。



为了缩小包文件夹的大小,我尝试通过以下方式删除我的概念文件夹:

  git filter-branch --index-filter'git rm -rf --cached --ignore-unmatch DIRECTORY /'--prune-empty --tag-name-filter cat  -   - -all 

之后

  git gc --aggressive --prune 

执行这些命令后,我的概念文件夹已从文件系统和所有提交中删除。 Bingo!



但是包装文件仍然是1,3 GB



我搜索了stackoverflow,但是我发现是我在上面使用的命令。
也许任何人对我有更多的信息如何缩小包文件夹。我认为它的大小为1,3 GB来自该概念文件夹,并在55次提交期间提交。



最好的问候,
Andreas

解决方案

之前我提到过 git gc 本身可以增加回购的大小)



我列出的命令是:

 #删除临时历史记录git-filter-branch否则会遗留很长时间
rm -rf .git / refs / original /&& git reflog expire --all&& git gc --aggressive --prune = now

如果不行,请查看< a href =http://rtyley.github.io/bfg-repo-cleaner/ =nofollow noreferrer> BFG工具。

如何从我的git repo中删除未引用的斑点可以找到更完整的gc

本文建议采用类似的方法:

  rm -rf .git / refs / original / 
git reflog expire --expire = now --all
git fsck --full --unreachable
git repack -A -d
git gc --aggressive --prune = now


I got a relatively small git repository in which is a standard wordpress installation. But in addition i accidently have a "concept" folder in the repository with a lot of bigger psd files in it.

The problem is now, after 50 commits, that git has created a "pack" file, which is 1,3 GB. Way too big!

To downsize the pack folder i tried to remove my "concept" folder via:

git filter-branch --index-filter 'git rm -rf --cached --ignore-unmatch DIRECTORY/' --prune-empty --tag-name-filter cat -- --all

and afterwards

git gc --aggressive --prune

After the execution of these commands, my "concept" folder was deleted from the file system and from all commits. Bingo!

But still the pack file is exactly 1,3 GB

I searched stackoverflow but all i found was the commands i used above. Maybe anyone has any more info for me how to downsize the pack folder. I think it's size of 1,3 GB comes from that "concept" folder and it's commits during the 55 commits.

Best regards, Andreas

解决方案

I mentioned before that a git gc alone can actually increase the size of the repo).

The commands I was listing were:

# remove the temporary history git-filter-branch otherwise leaves behind for a long time
rm -rf .git/refs/original/ && git reflog expire --all &&  git gc --aggressive --prune=now

If that doesn't work, check out the BFG tool.

You will find an even more complete gc in "How to remove unreferenced blobs from my git repo"

This article suggests a similar approach:

rm -rf .git/refs/original/
git reflog expire --expire=now --all
git fsck --full --unreachable
git repack -A -d
git gc --aggressive --prune=now

这篇关于git大包文件,删除并重写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆