blob: 92f146d27dc363519e04d0b132e43b0a4667cac8 [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-repack(1)
2=============
3
4NAME
5----
Junio C Hamano7c73c662007-01-19 00:37:506git-repack - Pack unpacked objects in a repository
Junio C Hamano1a4e8412005-12-27 08:17:237
8
9SYNOPSIS
10--------
Junio C Hamano15567bc2011-07-23 00:51:5911[verse]
Junio C Hamanob9d9d902018-05-23 07:07:4212'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
Junio C Hamano1a4e8412005-12-27 08:17:2313
14DESCRIPTION
15-----------
16
Junio C Hamano79a784d2013-10-28 19:15:4317This command is used to combine all objects that do not currently
Junio C Hamanoa6387422007-08-25 03:54:2718reside in a "pack", into a pack. It can also be used to re-organize
Junio C Hamano401939f2007-07-01 06:34:3019existing packs into a single, more efficient pack.
Junio C Hamano1a4e8412005-12-27 08:17:2320
21A pack is a collection of objects, individually compressed, with
22delta compression applied, stored in a single file, with an
23associated index file.
24
25Packs are used to reduce the load on mirror systems, backup
26engines, disk storage, etc.
27
28OPTIONS
29-------
30
31-a::
32Instead of incrementally packing the unpacked objects,
Junio C Hamano401939f2007-07-01 06:34:3033pack everything referenced into a single pack.
Junio C Hamano1a4e8412005-12-27 08:17:2334Especially useful when packing a repository that is used
Junio C Hamano4d81e522009-06-10 08:08:5135for private development. Use
Junio C Hamano92d80372016-07-13 22:00:0536with `-d`. This will clean up the objects that `git prune`
Junio C Hamano81d540a2012-03-02 19:52:4737leaves behind, but `git fsck --full --dangling` shows as
Junio C Hamano401939f2007-07-01 06:34:3038dangling.
Junio C Hamano4d81e522009-06-10 08:08:5139+
40Note that users fetching over dumb protocols will have to fetch the
41whole new pack in order to get any contained object, no matter how many
42other objects in that pack they already have locally.
Junio C Hamano11ae3202018-08-20 20:15:4243+
44Promisor packfiles are repacked separately: if there are packfiles that
45have an associated ".promisor" file, these packfiles will be repacked
46into another separate pack, and an empty ".promisor" file corresponding
47to the new separate pack will be written.
Junio C Hamano1a4e8412005-12-27 08:17:2348
Junio C Hamanob713ff12008-05-24 01:12:3049-A::
Junio C Hamano92d80372016-07-13 22:00:0550Same as `-a`, unless `-d` is used. Then any unreachable
Junio C Hamanobba37ad2008-11-16 17:47:5951objects in a previous pack become loose, unpacked objects,
52instead of being left in the old pack. Unreachable objects
53are never intentionally added to a pack, even when repacking.
54This option prevents unreachable objects from being immediately
Junio C Hamanob713ff12008-05-24 01:12:3055deleted by way of being left in the old pack and then
56removed. Instead, the loose unreachable objects
57will be pruned according to normal expiry rules
Junio C Hamano1aa40d22010-01-21 17:46:4358with the next 'git gc' invocation. See linkgit:git-gc[1].
Junio C Hamanob713ff12008-05-24 01:12:3059
Junio C Hamano1a4e8412005-12-27 08:17:2360-d::
61After packing, if the newly created packs make some
62existing packs redundant, remove the redundant packs.
Junio C Hamano1aa40d22010-01-21 17:46:4363Also run 'git prune-packed' to remove redundant
Junio C Hamanofce7c7e2008-07-02 03:06:3864loose object files.
Junio C Hamano1a4e8412005-12-27 08:17:2365
66-l::
Junio C Hamano1aa40d22010-01-21 17:46:4367Pass the `--local` option to 'git pack-objects'. See
Junio C Hamano35738e82008-01-07 07:55:4668linkgit:git-pack-objects[1].
Junio C Hamano1a4e8412005-12-27 08:17:2369
Junio C Hamano7e9f6b72006-02-22 10:44:5570-f::
Junio C Hamano657fd8a2010-10-07 00:01:2471Pass the `--no-reuse-delta` option to `git-pack-objects`, see
72linkgit:git-pack-objects[1].
73
74-F::
Junio C Hamano7cc91292008-09-20 16:55:3875Pass the `--no-reuse-object` option to `git-pack-objects`, see
Junio C Hamano35738e82008-01-07 07:55:4676linkgit:git-pack-objects[1].
Junio C Hamano7e9f6b72006-02-22 10:44:5577
78-q::
Junio C Hamano1aa40d22010-01-21 17:46:4379Pass the `-q` option to 'git pack-objects'. See
Junio C Hamano35738e82008-01-07 07:55:4680linkgit:git-pack-objects[1].
Junio C Hamano7e9f6b72006-02-22 10:44:5581
Junio C Hamano1a4e8412005-12-27 08:17:2382-n::
Junio C Hamanob713ff12008-05-24 01:12:3083Do not update the server information with
Junio C Hamano1aa40d22010-01-21 17:46:4384'git update-server-info'. This option skips
Junio C Hamanob713ff12008-05-24 01:12:3085updating local catalog files needed to publish
86this repository (or a direct copy of it)
Junio C Hamanoba4b9282008-07-06 05:20:3187over HTTP or FTP. See linkgit:git-update-server-info[1].
Junio C Hamano1a4e8412005-12-27 08:17:2388
Junio C Hamanod2179ef2010-10-22 04:12:1789--window=<n>::
90--depth=<n>::
Junio C Hamano93567a62006-10-08 08:47:5691These two options affect how the objects contained in the pack are
Junio C Hamano3eb513f2006-09-18 02:47:1692stored using delta compression. The objects are first internally
93sorted by type, size and optionally names and compared against the
94other objects within `--window` to see if using delta compression saves
95space. `--depth` limits the maximum delta depth; making it too deep
96affects the performance on the unpacker side, because delta data needs
97to be applied that many times to get to the necessary object.
Junio C Hamanob9d9d902018-05-23 07:07:4298+
99The default value for --window is 10 and --depth is 50. The maximum
100depth is 4095.
Junio C Hamano3eb513f2006-09-18 02:47:16101
Junio C Hamano6b6144f2017-05-29 06:20:15102--threads=<n>::
103This option is passed through to `git pack-objects`.
104
Junio C Hamanod2179ef2010-10-22 04:12:17105--window-memory=<n>::
Junio C Hamano235d53f2007-07-13 00:25:15106This option provides an additional limit on top of `--window`;
107the window size will dynamically scale down so as to not take
Junio C Hamanod2179ef2010-10-22 04:12:17108up more than '<n>' bytes in memory. This is useful in
Junio C Hamano235d53f2007-07-13 00:25:15109repositories with a mix of large and small objects to not run
110out of memory with a large window, but still be able to take
111advantage of the large window for the smaller objects. The
112size can be suffixed with "k", "m", or "g".
Junio C Hamano0f1d17c2016-08-12 19:42:26113`--window-memory=0` makes memory usage unlimited. The default
114is taken from the `pack.windowMemory` configuration variable.
115Note that the actual memory usage will be the limit multiplied
116by the number of threads used by linkgit:git-pack-objects[1].
Junio C Hamano235d53f2007-07-13 00:25:15117
Junio C Hamanod2179ef2010-10-22 04:12:17118--max-pack-size=<n>::
Junio C Hamano4d979582010-02-04 06:27:29119Maximum size of each output pack file. The size can be suffixed with
120"k", "m", or "g". The minimum size allowed is limited to 1 MiB.
Junio C Hamano74fd0fc2016-05-10 21:23:56121If specified, multiple packfiles may be created, which also
122prevents the creation of a bitmap index.
Junio C Hamano4d979582010-02-04 06:27:29123The default is unlimited, unless the config variable
124`pack.packSizeLimit` is set.
Junio C Hamano591dc6a2007-05-29 09:18:19125
Junio C Hamano5b3533d2014-02-27 23:07:15126-b::
127--write-bitmap-index::
128Write a reachability bitmap index as part of the repack. This
129only makes sense when used with `-a` or `-A`, as the bitmaps
130must be able to refer to all reachable objects. This option
Junio C Hamano74fd0fc2016-05-10 21:23:56131overrides the setting of `repack.writeBitmaps`. This option
132has no effect if multiple packfiles are created.
Junio C Hamano5b3533d2014-02-27 23:07:15133
Junio C Hamano3b0cdc22014-03-18 22:06:16134--pack-kept-objects::
135Include objects in `.keep` files when repacking. Note that we
136still do not delete `.keep` packs after `pack-objects` finishes.
137This means that we may duplicate objects, but this makes the
138option safe to use when there are concurrent pushes or fetches.
139This option is generally only useful if you are writing bitmaps
Junio C Hamano74fd0fc2016-05-10 21:23:56140with `-b` or `repack.writeBitmaps`, as it ensures that the
Junio C Hamano3b0cdc22014-03-18 22:06:16141bitmapped packfile has the necessary objects.
Junio C Hamano3eb513f2006-09-18 02:47:16142
Junio C Hamanob9d9d902018-05-23 07:07:42143--keep-pack=<pack-name>::
144Exclude the given pack from repacking. This is the equivalent
Junio C Hamano556b57e2019-08-12 17:46:38145of having `.keep` file on the pack. `<pack-name>` is the
Junio C Hamanob9d9d902018-05-23 07:07:42146pack file name without leading directory (e.g. `pack-123.pack`).
147The option could be specified multiple times to keep multiple
148packs.
149
Junio C Hamanoc6c919b2016-07-06 21:34:15150--unpack-unreachable=<when>::
151When loosening unreachable objects, do not bother loosening any
152objects older than `<when>`. This can be used to optimize out
153the write of any objects that would be immediately pruned by
154a follow-up `git prune`.
155
156-k::
157--keep-unreachable::
158When used with `-ad`, any unreachable objects from existing
159packs will be appended to the end of the packfile instead of
160being removed. In addition, any unreachable loose objects will
161be packed (and their loose counterparts removed).
162
Junio C Hamano980e61e2018-09-17 22:45:52163-i::
164--delta-islands::
165Pass the `--delta-islands` option to `git-pack-objects`, see
166linkgit:git-pack-objects[1].
167
Junio C Hamano77b7e902006-10-23 07:18:50168Configuration
169-------------
170
Junio C Hamanod3304322010-02-05 03:28:27171By default, the command passes `--delta-base-offset` option to
172'git pack-objects'; this typically results in slightly smaller packs,
173but the generated packs are incompatible with versions of Git older than
174version 1.4.4. If you need to share your repository with such ancient Git
Junio C Hamanof85ef632016-02-17 22:31:06175versions, either directly or via the dumb http protocol, then you
Junio C Hamanod3304322010-02-05 03:28:27176need to set the configuration variable `repack.UseDeltaBaseOffset` to
177"false" and repack. Access from old Git versions over the native protocol
178is unaffected by this option as the conversion is performed on the fly
179as needed in that case.
Junio C Hamano77b7e902006-10-23 07:18:50180
Junio C Hamano9049d912008-05-29 02:09:50181SEE ALSO
Junio C Hamano1a4e8412005-12-27 08:17:23182--------
Junio C Hamano35738e82008-01-07 07:55:46183linkgit:git-pack-objects[1]
184linkgit:git-prune-packed[1]
Junio C Hamano1a4e8412005-12-27 08:17:23185
186GIT
187---
Junio C Hamanof7c042d2008-06-06 22:50:53188Part of the linkgit:git[1] suite