| English | 中文 |
Large repositories require periodic maintenance.
Repository maintenance is not just about running git gc; it also includes managing file boundaries, history volume, branch cleanup, dependency governance, and document timeliness.
git count-objects -vH
This command displays object counts and sizes, useful for determining if the repository needs cleanup.
git gc
git maintenance start
git commit-graph write --reachable
Whether these commands are appropriate needs to be verified against the team’s environment, Git version, and repository scale.
View merged branches:
git branch --merged
Delete local branch:
git branch -d feature/old-task
Prune deleted remote branch references:
git fetch --prune
Periodic checks:
This repository itself also needs maintenance: