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