seniorGit

How does Git garbage collection (gc) work?

Updated Apr 23, 2026

Short answer

GC cleans unreachable objects and packs objects for efficiency.

Deep explanation

git gc prunes dangling objects (after grace period) and packs objects into packfiles with delta compression. It improves performance and reduces size.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More Git interview questions

View all →