Merge branch 'nd/pack-objects-pack-struct'
[git.git] / Documentation / git-repack.txt
blobd90e7907f4843a048caf11a2fae42a973d893d9a
1 git-repack(1)
2 =============
4 NAME
5 ----
6 git-repack - Pack unpacked objects in a repository
9 SYNOPSIS
10 --------
11 [verse]
12 'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
14 DESCRIPTION
15 -----------
17 This command is used to combine all objects that do not currently
18 reside in a "pack", into a pack.  It can also be used to re-organize
19 existing packs into a single, more efficient pack.
21 A pack is a collection of objects, individually compressed, with
22 delta compression applied, stored in a single file, with an
23 associated index file.
25 Packs are used to reduce the load on mirror systems, backup
26 engines, disk storage, etc.
28 OPTIONS
29 -------
31 -a::
32         Instead of incrementally packing the unpacked objects,
33         pack everything referenced into a single pack.
34         Especially useful when packing a repository that is used
35         for private development. Use
36         with `-d`.  This will clean up the objects that `git prune`
37         leaves behind, but `git fsck --full --dangling` shows as
38         dangling.
40 Note that users fetching over dumb protocols will have to fetch the
41 whole new pack in order to get any contained object, no matter how many
42 other objects in that pack they already have locally.
44 -A::
45         Same as `-a`, unless `-d` is used.  Then any unreachable
46         objects in a previous pack become loose, unpacked objects,
47         instead of being left in the old pack.  Unreachable objects
48         are never intentionally added to a pack, even when repacking.
49         This option prevents unreachable objects from being immediately
50         deleted by way of being left in the old pack and then
51         removed.  Instead, the loose unreachable objects
52         will be pruned according to normal expiry rules
53         with the next 'git gc' invocation. See linkgit:git-gc[1].
55 -d::
56         After packing, if the newly created packs make some
57         existing packs redundant, remove the redundant packs.
58         Also run  'git prune-packed' to remove redundant
59         loose object files.
61 -l::
62         Pass the `--local` option to 'git pack-objects'. See
63         linkgit:git-pack-objects[1].
65 -f::
66         Pass the `--no-reuse-delta` option to `git-pack-objects`, see
67         linkgit:git-pack-objects[1].
69 -F::
70         Pass the `--no-reuse-object` option to `git-pack-objects`, see
71         linkgit:git-pack-objects[1].
73 -q::
74         Pass the `-q` option to 'git pack-objects'. See
75         linkgit:git-pack-objects[1].
77 -n::
78         Do not update the server information with
79         'git update-server-info'.  This option skips
80         updating local catalog files needed to publish
81         this repository (or a direct copy of it)
82         over HTTP or FTP.  See linkgit:git-update-server-info[1].
84 --window=<n>::
85 --depth=<n>::
86         These two options affect how the objects contained in the pack are
87         stored using delta compression. The objects are first internally
88         sorted by type, size and optionally names and compared against the
89         other objects within `--window` to see if using delta compression saves
90         space. `--depth` limits the maximum delta depth; making it too deep
91         affects the performance on the unpacker side, because delta data needs
92         to be applied that many times to get to the necessary object.
94 The default value for --window is 10 and --depth is 50. The maximum
95 depth is 4095.
97 --threads=<n>::
98         This option is passed through to `git pack-objects`.
100 --window-memory=<n>::
101         This option provides an additional limit on top of `--window`;
102         the window size will dynamically scale down so as to not take
103         up more than '<n>' bytes in memory.  This is useful in
104         repositories with a mix of large and small objects to not run
105         out of memory with a large window, but still be able to take
106         advantage of the large window for the smaller objects.  The
107         size can be suffixed with "k", "m", or "g".
108         `--window-memory=0` makes memory usage unlimited.  The default
109         is taken from the `pack.windowMemory` configuration variable.
110         Note that the actual memory usage will be the limit multiplied
111         by the number of threads used by linkgit:git-pack-objects[1].
113 --max-pack-size=<n>::
114         Maximum size of each output pack file. The size can be suffixed with
115         "k", "m", or "g". The minimum size allowed is limited to 1 MiB.
116         If specified, multiple packfiles may be created, which also
117         prevents the creation of a bitmap index.
118         The default is unlimited, unless the config variable
119         `pack.packSizeLimit` is set.
121 -b::
122 --write-bitmap-index::
123         Write a reachability bitmap index as part of the repack. This
124         only makes sense when used with `-a` or `-A`, as the bitmaps
125         must be able to refer to all reachable objects. This option
126         overrides the setting of `repack.writeBitmaps`.  This option
127         has no effect if multiple packfiles are created.
129 --pack-kept-objects::
130         Include objects in `.keep` files when repacking.  Note that we
131         still do not delete `.keep` packs after `pack-objects` finishes.
132         This means that we may duplicate objects, but this makes the
133         option safe to use when there are concurrent pushes or fetches.
134         This option is generally only useful if you are writing bitmaps
135         with `-b` or `repack.writeBitmaps`, as it ensures that the
136         bitmapped packfile has the necessary objects.
138 --keep-pack=<pack-name>::
139         Exclude the given pack from repacking. This is the equivalent
140         of having `.keep` file on the pack. `<pack-name>` is the the
141         pack file name without leading directory (e.g. `pack-123.pack`).
142         The option could be specified multiple times to keep multiple
143         packs.
145 --unpack-unreachable=<when>::
146         When loosening unreachable objects, do not bother loosening any
147         objects older than `<when>`. This can be used to optimize out
148         the write of any objects that would be immediately pruned by
149         a follow-up `git prune`.
151 -k::
152 --keep-unreachable::
153         When used with `-ad`, any unreachable objects from existing
154         packs will be appended to the end of the packfile instead of
155         being removed. In addition, any unreachable loose objects will
156         be packed (and their loose counterparts removed).
158 Configuration
159 -------------
161 By default, the command passes `--delta-base-offset` option to
162 'git pack-objects'; this typically results in slightly smaller packs,
163 but the generated packs are incompatible with versions of Git older than
164 version 1.4.4. If you need to share your repository with such ancient Git
165 versions, either directly or via the dumb http protocol, then you
166 need to set the configuration variable `repack.UseDeltaBaseOffset` to
167 "false" and repack. Access from old Git versions over the native protocol
168 is unaffected by this option as the conversion is performed on the fly
169 as needed in that case.
171 SEE ALSO
172 --------
173 linkgit:git-pack-objects[1]
174 linkgit:git-prune-packed[1]
178 Part of the linkgit:git[1] suite