File pack in excessively large repository

1

Recently I cloned a repository that contains a few Python files and Jinja templates, but when I checked the size of the repository I realized that it has more than 130 megabytes.

I checked the directory and found in .git\objects\pack a file that has these 130 megs.

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-ar--     11/05/2017  11:32 a. m.     201356 pack-9da98c5cce72bd8da0a68ec2594dedec9ae48d24.idx
-ar--     11/05/2017  11:32 a. m.  133944653 pack-9da98c5cce72bd8da0a68ec2594dedec9ae48d24.pack

Questions

  • What are those .pack files?
  • Can I delete them without worries or contain important information related to my repository?
  • If I can not delete them directly, how can I reduce their size?
  •   

    It only occurs to me that I have a file history ... It is the repository of my personal blog and at some point I saved large files there, although now it only has text files and this .pack ...

    I cloned the repository in Windows 8, but I usually occupy macOS Sierra or some variety of Ubuntu.

        
    asked by toledano 11.05.2017 в 18:42
    source

    1 answer

    2
      

    What are those .pack files?

    These are the files that Git creates when it tries to save space. Basically, Git takes several objects and tries to combine them in a single binary file, the pack file, applying compression to save space.

    Reference: link .

      

    Can I delete them without worries or contain important information related to my repository?

    No, you can not delete them without corrupting your repository.

      

    If I can not delete them directly, how can I reduce their size?

    The truth is that you can not. Git is already trying to reduce the size of the repository using the pack files.

    As you suspected, Git keeps the entire history of your repository. So, although now you only have small text files, if at any time in the history of the repository you had large files, especially binary files that may not benefit so much from compression, then this would explain why the repository is larger than it is. you wait.

    If you want to reduce the size of your repository, you would have to produce a different repository that does not include all the history, in particular the part of the history that includes the large files.

        
    answered by 11.05.2017 / 19:48
    source