Why repositories need maintenance
Git repositories accumulate objects, references and historical data. Normal development is usually self-maintaining, but repositories containing large generated files or extensive rewritten history can require maintenance.
Garbage collection and repacking
Git can repack objects and remove data that is no longer reachable after appropriate expiration rules. Modern Git performs maintenance automatically in many situations, but understanding the concepts helps when diagnosing repository size or performance.
Do not run aggressive cleanup blindly
Before deleting unreachable data, make sure no recovery or collaboration workflow still needs it. Maintenance commands can affect your ability to recover recently deleted local commits.