1git-gc(1) 2========= 3 4NAME 5---- 6git-gc - Cleanup unnecessary files and optimize the local repository 7 8 9SYNOPSIS 10-------- 11'git-gc' [--prune] [--aggressive] [--auto] 12 13DESCRIPTION 14----------- 15Runs a number of housekeeping tasks within the current repository, 16such as compressing file revisions (to reduce disk space and increase 17performance) and removing unreachable objects which may have been 18created from prior invocations of gitlink:git-add[1]. 19 20Users are encouraged to run this task on a regular basis within 21each repository to maintain good disk space utilization and good 22operating performance. 23 24OPTIONS 25------- 26 27--prune:: 28 Usually `git-gc` packs refs, expires old reflog entries, 29 packs loose objects, 30 and removes old 'rerere' records. Removal 31 of unreferenced loose objects is an unsafe operation 32 while other git operations are in progress, so it is not 33 done by default. Pass this option if you want it, and only 34 when you know nobody else is creating new objects in the 35 repository at the same time (e.g. never use this option 36 in a cron script). 37 38--aggressive:: 39 Usually 'git-gc' runs very quickly while providing good disk 40 space utilization and performance. This option will cause 41 git-gc to more aggressively optimize the repository at the expense 42 of taking much more time. The effects of this optimization are 43 persistent, so this option only needs to be used occasionally; every 44 few hundred changesets or so. 45 46--auto:: 47 With this option, `git gc` checks if there are too many 48 loose objects in the repository and runs 49 gitlink:git-repack[1] with `-d -l` option to pack them. 50 The threshold for loose objects is set with `gc.auto` configuration 51 variable, and can be disabled by setting it to 0. Some 52 Porcelain commands use this after they perform operation 53 that could create many loose objects automatically. 54 Additionally, when there are too many packs are present, 55 they are consolidated into one larger pack by running 56 the `git-repack` command with `-A` option. The 57 threshold for number of packs is set with 58 `gc.autopacklimit` configuration variable. 59 60Configuration 61------------- 62 63The optional configuration variable 'gc.reflogExpire' can be 64set to indicate how long historical entries within each branch's 65reflog should remain available in this repository. The setting is 66expressed as a length of time, for example '90 days' or '3 months'. 67It defaults to '90 days'. 68 69The optional configuration variable 'gc.reflogExpireUnreachable' 70can be set to indicate how long historical reflog entries which 71are not part of the current branch should remain available in 72this repository. These types of entries are generally created as 73a result of using `git commit \--amend` or `git rebase` and are the 74commits prior to the amend or rebase occurring. Since these changes 75are not part of the current project most users will want to expire 76them sooner. This option defaults to '30 days'. 77 78The optional configuration variable 'gc.rerereresolved' indicates 79how long records of conflicted merge you resolved earlier are 80kept. This defaults to 60 days. 81 82The optional configuration variable 'gc.rerereunresolved' indicates 83how long records of conflicted merge you have not resolved are 84kept. This defaults to 15 days. 85 86The optional configuration variable 'gc.packrefs' determines if 87`git gc` runs `git-pack-refs`. Without the configuration, `git-pack-refs` 88is not run in bare repositories by default, to allow older dumb-transport 89clients fetch from the repository, but this will change in the future. 90 91The optional configuration variable 'gc.aggressiveWindow' controls how 92much time is spent optimizing the delta compression of the objects in 93the repository when the --aggressive option is specified. The larger 94the value, the more time is spent optimizing the delta compression. See 95the documentation for the --window' option in gitlink:git-repack[1] for 96more details. This defaults to 10. 97 98See Also 99-------- 100gitlink:git-prune[1] 101gitlink:git-reflog[1] 102gitlink:git-repack[1] 103gitlink:git-rerere[1] 104 105Author 106------ 107Written by Shawn O. Pearce <spearce@spearce.org> 108 109GIT 110--- 111Part of the gitlink:git[7] suite