1GIT-REPACK(1)                     Git Manual                     GIT-REPACK(1)
2
3
4

NAME

6       git-repack - Pack unpacked objects in a repository
7

SYNOPSIS

9       git repack [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [-m] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>] [--write-midx]
10

DESCRIPTION

12       This command is used to combine all objects that do not currently
13       reside in a "pack", into a pack. It can also be used to re-organize
14       existing packs into a single, more efficient pack.
15
16       A pack is a collection of objects, individually compressed, with delta
17       compression applied, stored in a single file, with an associated index
18       file.
19
20       Packs are used to reduce the load on mirror systems, backup engines,
21       disk storage, etc.
22

OPTIONS

24       -a
25           Instead of incrementally packing the unpacked objects, pack
26           everything referenced into a single pack. Especially useful when
27           packing a repository that is used for private development. Use with
28           -d. This will clean up the objects that git prune leaves behind,
29           but git fsck --full --dangling shows as dangling.
30
31           Note that users fetching over dumb protocols will have to fetch the
32           whole new pack in order to get any contained object, no matter how
33           many other objects in that pack they already have locally.
34
35           Promisor packfiles are repacked separately: if there are packfiles
36           that have an associated ".promisor" file, these packfiles will be
37           repacked into another separate pack, and an empty ".promisor" file
38           corresponding to the new separate pack will be written.
39
40       -A
41           Same as -a, unless -d is used. Then any unreachable objects in a
42           previous pack become loose, unpacked objects, instead of being left
43           in the old pack. Unreachable objects are never intentionally added
44           to a pack, even when repacking. This option prevents unreachable
45           objects from being immediately deleted by way of being left in the
46           old pack and then removed. Instead, the loose unreachable objects
47           will be pruned according to normal expiry rules with the next git
48           gc invocation. See git-gc(1).
49
50       -d
51           After packing, if the newly created packs make some existing packs
52           redundant, remove the redundant packs. Also run git prune-packed to
53           remove redundant loose object files.
54
55       --cruft
56           Same as -a, unless -d is used. Then any unreachable objects are
57           packed into a separate cruft pack. Unreachable objects can be
58           pruned using the normal expiry rules with the next git gc
59           invocation (see git-gc(1)). Incompatible with -k.
60
61       --cruft-expiration=<approxidate>
62           Expire unreachable objects older than <approxidate> immediately
63           instead of waiting for the next git gc invocation. Only useful with
64           --cruft -d.
65
66       --expire-to=<dir>
67           Write a cruft pack containing pruned objects (if any) to the
68           directory <dir>. This option is useful for keeping a copy of any
69           pruned objects in a separate directory as a backup. Only useful
70           with --cruft -d.
71
72       -l
73           Pass the --local option to git pack-objects. See git-pack-
74           objects(1).
75
76       -f
77           Pass the --no-reuse-delta option to git-pack-objects, see git-pack-
78           objects(1).
79
80       -F
81           Pass the --no-reuse-object option to git-pack-objects, see git-
82           pack-objects(1).
83
84       -q, --quiet
85           Show no progress over the standard error stream and pass the -q
86           option to git pack-objects. See git-pack-objects(1).
87
88       -n
89           Do not update the server information with git update-server-info.
90           This option skips updating local catalog files needed to publish
91           this repository (or a direct copy of it) over HTTP or FTP. See git-
92           update-server-info(1).
93
94       --window=<n>, --depth=<n>
95           These two options affect how the objects contained in the pack are
96           stored using delta compression. The objects are first internally
97           sorted by type, size and optionally names and compared against the
98           other objects within --window to see if using delta compression
99           saves space.  --depth limits the maximum delta depth; making it too
100           deep affects the performance on the unpacker side, because delta
101           data needs to be applied that many times to get to the necessary
102           object.
103
104           The default value for --window is 10 and --depth is 50. The maximum
105           depth is 4095.
106
107       --threads=<n>
108           This option is passed through to git pack-objects.
109
110       --window-memory=<n>
111           This option provides an additional limit on top of --window; the
112           window size will dynamically scale down so as to not take up more
113           than <n> bytes in memory. This is useful in repositories with a mix
114           of large and small objects to not run out of memory with a large
115           window, but still be able to take advantage of the large window for
116           the smaller objects. The size can be suffixed with "k", "m", or
117           "g".  --window-memory=0 makes memory usage unlimited. The default
118           is taken from the pack.windowMemory configuration variable. Note
119           that the actual memory usage will be the limit multiplied by the
120           number of threads used by git-pack-objects(1).
121
122       --max-pack-size=<n>
123           Maximum size of each output pack file. The size can be suffixed
124           with "k", "m", or "g". The minimum size allowed is limited to 1
125           MiB. If specified, multiple packfiles may be created, which also
126           prevents the creation of a bitmap index. The default is unlimited,
127           unless the config variable pack.packSizeLimit is set. Note that
128           this option may result in a larger and slower repository; see the
129           discussion in pack.packSizeLimit.
130
131       -b, --write-bitmap-index
132           Write a reachability bitmap index as part of the repack. This only
133           makes sense when used with -a, -A or -m, as the bitmaps must be
134           able to refer to all reachable objects. This option overrides the
135           setting of repack.writeBitmaps. This option has no effect if
136           multiple packfiles are created, unless writing a MIDX (in which
137           case a multi-pack bitmap is created).
138
139       --pack-kept-objects
140           Include objects in .keep files when repacking. Note that we still
141           do not delete .keep packs after pack-objects finishes. This means
142           that we may duplicate objects, but this makes the option safe to
143           use when there are concurrent pushes or fetches. This option is
144           generally only useful if you are writing bitmaps with -b or
145           repack.writeBitmaps, as it ensures that the bitmapped packfile has
146           the necessary objects.
147
148       --keep-pack=<pack-name>
149           Exclude the given pack from repacking. This is the equivalent of
150           having .keep file on the pack.  <pack-name> is the pack file name
151           without leading directory (e.g.  pack-123.pack). The option could
152           be specified multiple times to keep multiple packs.
153
154       --unpack-unreachable=<when>
155           When loosening unreachable objects, do not bother loosening any
156           objects older than <when>. This can be used to optimize out the
157           write of any objects that would be immediately pruned by a
158           follow-up git prune.
159
160       -k, --keep-unreachable
161           When used with -ad, any unreachable objects from existing packs
162           will be appended to the end of the packfile instead of being
163           removed. In addition, any unreachable loose objects will be packed
164           (and their loose counterparts removed).
165
166       -i, --delta-islands
167           Pass the --delta-islands option to git-pack-objects, see git-pack-
168           objects(1).
169
170       -g=<factor>, --geometric=<factor>
171           Arrange resulting pack structure so that each successive pack
172           contains at least <factor> times the number of objects as the
173           next-largest pack.
174
175           git repack ensures this by determining a "cut" of packfiles that
176           need to be repacked into one in order to ensure a geometric
177           progression. It picks the smallest set of packfiles such that as
178           many of the larger packfiles (by count of objects contained in that
179           pack) may be left intact.
180
181           Unlike other repack modes, the set of objects to pack is determined
182           uniquely by the set of packs being "rolled-up"; in other words, the
183           packs determined to need to be combined in order to restore a
184           geometric progression.
185
186           When --unpacked is specified, loose objects are implicitly included
187           in this "roll-up", without respect to their reachability. This is
188           subject to change in the future. This option (implying a
189           drastically different repack mode) is not guaranteed to work with
190           all other combinations of option to git repack.
191
192           When writing a multi-pack bitmap, git repack selects the largest
193           resulting pack as the preferred pack for object selection by the
194           MIDX (see git-multi-pack-index(1)).
195
196       -m, --write-midx
197           Write a multi-pack index (see git-multi-pack-index(1)) containing
198           the non-redundant packs.
199

CONFIGURATION

201       Various configuration variables affect packing, see git-config(1)
202       (search for "pack" and "delta").
203
204       By default, the command passes --delta-base-offset option to git
205       pack-objects; this typically results in slightly smaller packs, but the
206       generated packs are incompatible with versions of Git older than
207       version 1.4.4. If you need to share your repository with such ancient
208       Git versions, either directly or via the dumb http protocol, then you
209       need to set the configuration variable repack.UseDeltaBaseOffset to
210       "false" and repack. Access from old Git versions over the native
211       protocol is unaffected by this option as the conversion is performed on
212       the fly as needed in that case.
213
214       Delta compression is not used on objects larger than the
215       core.bigFileThreshold configuration variable and on files with the
216       attribute delta set to false.
217

SEE ALSO

219       git-pack-objects(1) git-prune-packed(1)
220

GIT

222       Part of the git(1) suite
223
224
225
226Git 2.39.1                        2023-01-13                     GIT-REPACK(1)
Impressum