March 6, 2012

Managing .git file size

Managing .git file size

While using the main problem we will be facing is large size of .git folder inside your repository. Follow below commands from your repository for the best way to cut down the size with out effecting the commit history:

# git reflog expire --expire=0 –all
# git repack –ad
# git prune
# git gc


Reflog is a mechanism to record when the tip of branches are updated. This command is to manage the information recorded in it. The subcommand "expire" is used to prune older reflog entries. Entries older than expire time, or entries older than expire-unreachable time and not reachable from the current tip, are removed from the reflog.

Repack is used to combine all objects that do not currently reside in a "pack", into a pack. It can also be used to re-organize existing packs into a single, more efficient pack.A pack is a collection of objects, individually compressed, with delta compression applied, stored in a single file, with an associated index file.Packs are used to reduce the load on mirror systems, backup engines, disk storage, etc.

Prune - Prune all unreachable objects from the object database.

GC Cleanup unnecessary files and optimize the local repository.

No comments:

Post a Comment