my-git

Repo Maintenance

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.

Checklist

Local Object Inspection

git count-objects -vH

This command displays object counts and sizes, useful for determining if the repository needs cleanup.

Local Maintenance Commands

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.

Branch Cleanup

View merged branches:

git branch --merged

Delete local branch:

git branch -d feature/old-task

Prune deleted remote branch references:

git fetch --prune

Large File Governance

Periodic checks:

Document Maintenance

This repository itself also needs maintenance:

Further Reading