git-gc
Cleanup and optimize repository storage
TLDR
Run garbage collection
SYNOPSIS
git gc [options]
DESCRIPTION
git gc (garbage collection) cleans up unnecessary files and optimizes the repository. It packs loose objects, removes unreachable objects, and compresses the repository for better performance.
Git runs gc automatically after certain operations. Manual gc is useful after history rewrites or large imports. Aggressive mode performs deeper optimization but takes significantly longer.
PARAMETERS
--aggressive
More thorough optimization (slow).--prune DATE
Prune objects older than date.--auto
Only run if needed.--quiet
Suppress output.--force
Force gc even if another running.--help
Display help information.
CAVEATS
Aggressive is slow. Running gc removes dangling objects. Let gc complete before other operations.
HISTORY
git gc is a core Git command for repository maintenance, automating cleanup tasks that were originally separate commands.
SEE ALSO
git-prune(1), git-repack(1), git-count-objects(1)
