| 42 | Doing Some Git Housekeeping |
One of Git’s key advantages is its speed. Keeping it fast requires
some tuning, however. The git gc command
provides the tuning tool.
git gc performs several housecleaning
tasks. First, it removes any “loose objects” in the
repository over a certain age. All of those commits you remove via
git rebase, git
reset, and so on, are still tracked by Git; they’re
just orphaned.
Second, it recalculates the deltas. Deltas are the differences between two pieces of content in the repository. Many times the first pass at creating the delta is not the most efficient. Recalculating the deltas with the help of hindsight allows Git to combine like deltas to reduce the size of the repository and decrease the time Git spends ...