1GIT-REPACK(1) Git Manual GIT-REPACK(1)
2
3
4
6 git-repack - Pack unpacked objects in a repository
7
9 git repack [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] [--threads=<n>] [--keep-pack=<pack-name>]
10
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
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 -l
56 Pass the --local option to git pack-objects. See git-pack-
57 objects(1).
58
59 -f
60 Pass the --no-reuse-delta option to git-pack-objects, see git-pack-
61 objects(1).
62
63 -F
64 Pass the --no-reuse-object option to git-pack-objects, see git-
65 pack-objects(1).
66
67 -q
68 Pass the -q option to git pack-objects. See git-pack-objects(1).
69
70 -n
71 Do not update the server information with git update-server-info.
72 This option skips updating local catalog files needed to publish
73 this repository (or a direct copy of it) over HTTP or FTP. See git-
74 update-server-info(1).
75
76 --window=<n>, --depth=<n>
77 These two options affect how the objects contained in the pack are
78 stored using delta compression. The objects are first internally
79 sorted by type, size and optionally names and compared against the
80 other objects within --window to see if using delta compression
81 saves space. --depth limits the maximum delta depth; making it too
82 deep affects the performance on the unpacker side, because delta
83 data needs to be applied that many times to get to the necessary
84 object.
85
86 The default value for --window is 10 and --depth is 50. The maximum
87 depth is 4095.
88
89 --threads=<n>
90 This option is passed through to git pack-objects.
91
92 --window-memory=<n>
93 This option provides an additional limit on top of --window; the
94 window size will dynamically scale down so as to not take up more
95 than <n> bytes in memory. This is useful in repositories with a mix
96 of large and small objects to not run out of memory with a large
97 window, but still be able to take advantage of the large window for
98 the smaller objects. The size can be suffixed with "k", "m", or
99 "g". --window-memory=0 makes memory usage unlimited. The default
100 is taken from the pack.windowMemory configuration variable. Note
101 that the actual memory usage will be the limit multiplied by the
102 number of threads used by git-pack-objects(1).
103
104 --max-pack-size=<n>
105 Maximum size of each output pack file. The size can be suffixed
106 with "k", "m", or "g". The minimum size allowed is limited to 1
107 MiB. If specified, multiple packfiles may be created, which also
108 prevents the creation of a bitmap index. The default is unlimited,
109 unless the config variable pack.packSizeLimit is set.
110
111 -b, --write-bitmap-index
112 Write a reachability bitmap index as part of the repack. This only
113 makes sense when used with -a or -A, as the bitmaps must be able to
114 refer to all reachable objects. This option overrides the setting
115 of repack.writeBitmaps. This option has no effect if multiple
116 packfiles are created.
117
118 --pack-kept-objects
119 Include objects in .keep files when repacking. Note that we still
120 do not delete .keep packs after pack-objects finishes. This means
121 that we may duplicate objects, but this makes the option safe to
122 use when there are concurrent pushes or fetches. This option is
123 generally only useful if you are writing bitmaps with -b or
124 repack.writeBitmaps, as it ensures that the bitmapped packfile has
125 the necessary objects.
126
127 --keep-pack=<pack-name>
128 Exclude the given pack from repacking. This is the equivalent of
129 having .keep file on the pack. <pack-name> is the pack file name
130 without leading directory (e.g. pack-123.pack). The option could
131 be specified multiple times to keep multiple packs.
132
133 --unpack-unreachable=<when>
134 When loosening unreachable objects, do not bother loosening any
135 objects older than <when>. This can be used to optimize out the
136 write of any objects that would be immediately pruned by a
137 follow-up git prune.
138
139 -k, --keep-unreachable
140 When used with -ad, any unreachable objects from existing packs
141 will be appended to the end of the packfile instead of being
142 removed. In addition, any unreachable loose objects will be packed
143 (and their loose counterparts removed).
144
145 -i, --delta-islands
146 Pass the --delta-islands option to git-pack-objects, see git-pack-
147 objects(1).
148
150 By default, the command passes --delta-base-offset option to git
151 pack-objects; this typically results in slightly smaller packs, but the
152 generated packs are incompatible with versions of Git older than
153 version 1.4.4. If you need to share your repository with such ancient
154 Git versions, either directly or via the dumb http protocol, then you
155 need to set the configuration variable repack.UseDeltaBaseOffset to
156 "false" and repack. Access from old Git versions over the native
157 protocol is unaffected by this option as the conversion is performed on
158 the fly as needed in that case.
159
161 git-pack-objects(1) git-prune-packed(1)
162
164 Part of the git(1) suite
165
166
167
168Git 2.26.2 2020-04-20 GIT-REPACK(1)