Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 20c7a96

Browse files
phdrubrettcannon
authored andcommitted
Maintaining git repo with git gc and git fsck (#83)
1 parent 450c2ec commit 20c7a96

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

committing.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,3 +455,27 @@ Forking repository
455455

456456
Forking a repository on GitHub is as simple as clicking Fork button in the right
457457
upper corner at https://github.com/python/cpython.
458+
459+
460+
Maintaining a repository
461+
-------------------------
462+
463+
The Git object database and other files/directories under ``.git`` require
464+
periodic maintenance and cleanup. For example, commit editing leaves
465+
unreferenced objects (dangling objects, in git terminology) and these
466+
objects should be pruned to avoid collecting cruft in the DB. The
467+
command ``git gc`` is used for maintenance. Git automatically runs
468+
``git gc --auto`` as a part of some commands to do quick maintenance.
469+
Users are recommended to run ``git gc --aggressive`` from time to
470+
time; ``git help gc`` recommends to run it every few hundred
471+
changesets; for CPython it should be something like once a week
472+
(GitHub itself runs the command weekly, so new checkouts do not need to
473+
perform this step).
474+
475+
``git gc --aggressive`` not only removes dangling objects, it also
476+
repacks object database into indexed and better optimized pack(s); it
477+
also packs symbolic references (branches and tags).
478+
479+
From time to time run ``git fsck --strict`` to verify integrity of
480+
the database. ``git fsck`` may produce a list of dangling objects;
481+
that's not an error, just a reminder to perform regular maintenance.

0 commit comments

Comments
 (0)