What does git gc actually do, and what is the role of prune and repack?
Last updated
git gccleans up the repo: it repacks, prunes, packs refs, expires reflogs, and rebuilds the commit-graph (often auto-triggered viagc.auto).prunedeletes unreachable objects older than a grace period (default 2 weeks) to avoid racing concurrent operations.repackmerges loose objects and packs into fewer delta-compressed packfiles, saving space and speeding lookups.
- https://www.geeksforgeeks.org/git/git-gc-garbage-collection/
- https://git-scm.com/docs/git-repack
- https://git-scm.com/docs/git-gc
- https://support.atlassian.com/bitbucket-data-center/kb/understanding-git-repack-and-git-prune-options-in-bitbucket-data-center/
- https://www.kernel.org/pub/software/scm/git/docs/git-prune.html
- https://github.blog/engineering/architecture-optimization/scaling-gits-garbage-collection/
- https://www.atlassian.com/git/tutorials/git-gc