What does git gc (garbage collection) do in a Git repository?

Git Hard

Git — Hard

What does git gc (garbage collection) do in a Git repository?

Key points

  • Git gc packs loose objects into packfiles for efficiency
  • Unreachable objects are removed after expiry
  • On-disk storage is optimized for better performance
  • Git gc does not affect .gitignore or branch management

Ready to go further?

Related questions