Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 1 | git-repack(1) |
| 2 | ============= |
| 3 | |
| 4 | NAME |
| 5 | ---- |
Junio C Hamano | 7c73c66 | 2007-01-19 00:37:50 | [diff] [blame] | 6 | git-repack - Pack unpacked objects in a repository |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 7 | |
| 8 | |
| 9 | SYNOPSIS |
| 10 | -------- |
Junio C Hamano | 15567bc | 2011-07-23 00:51:59 | [diff] [blame] | 11 | [verse] |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 12 | 'git repack' [-a] [-A] [-d] [-f] [-F] [-l] [-n] [-q] [-b] [--window=<n>] [--depth=<n>] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 13 | |
| 14 | DESCRIPTION |
| 15 | ----------- |
| 16 | |
Junio C Hamano | 79a784d | 2013-10-28 19:15:43 | [diff] [blame] | 17 | This command is used to combine all objects that do not currently |
Junio C Hamano | a638742 | 2007-08-25 03:54:27 | [diff] [blame] | 18 | reside in a "pack", into a pack. It can also be used to re-organize |
Junio C Hamano | 401939f | 2007-07-01 06:34:30 | [diff] [blame] | 19 | existing packs into a single, more efficient pack. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 20 | |
| 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. |
| 24 | |
| 25 | Packs are used to reduce the load on mirror systems, backup |
| 26 | engines, disk storage, etc. |
| 27 | |
| 28 | OPTIONS |
| 29 | ------- |
| 30 | |
| 31 | -a:: |
| 32 | Instead of incrementally packing the unpacked objects, |
Junio C Hamano | 401939f | 2007-07-01 06:34:30 | [diff] [blame] | 33 | pack everything referenced into a single pack. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 34 | Especially useful when packing a repository that is used |
Junio C Hamano | 4d81e52 | 2009-06-10 08:08:51 | [diff] [blame] | 35 | for private development. Use |
Junio C Hamano | 401939f | 2007-07-01 06:34:30 | [diff] [blame] | 36 | with '-d'. This will clean up the objects that `git prune` |
Junio C Hamano | 81d540a | 2012-03-02 19:52:47 | [diff] [blame] | 37 | leaves behind, but `git fsck --full --dangling` shows as |
Junio C Hamano | 401939f | 2007-07-01 06:34:30 | [diff] [blame] | 38 | dangling. |
Junio C Hamano | 4d81e52 | 2009-06-10 08:08:51 | [diff] [blame] | 39 | + |
| 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. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 43 | |
Junio C Hamano | b713ff1 | 2008-05-24 01:12:30 | [diff] [blame] | 44 | -A:: |
Junio C Hamano | bba37ad | 2008-11-16 17:47:59 | [diff] [blame] | 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 |
Junio C Hamano | b713ff1 | 2008-05-24 01:12:30 | [diff] [blame] | 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 |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 53 | with the next 'git gc' invocation. See linkgit:git-gc[1]. |
Junio C Hamano | b713ff1 | 2008-05-24 01:12:30 | [diff] [blame] | 54 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 55 | -d:: |
| 56 | After packing, if the newly created packs make some |
| 57 | existing packs redundant, remove the redundant packs. |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 58 | Also run 'git prune-packed' to remove redundant |
Junio C Hamano | fce7c7e | 2008-07-02 03:06:38 | [diff] [blame] | 59 | loose object files. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 60 | |
| 61 | -l:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 62 | Pass the `--local` option to 'git pack-objects'. See |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 63 | linkgit:git-pack-objects[1]. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 64 | |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 65 | -f:: |
Junio C Hamano | 657fd8a | 2010-10-07 00:01:24 | [diff] [blame] | 66 | Pass the `--no-reuse-delta` option to `git-pack-objects`, see |
| 67 | linkgit:git-pack-objects[1]. |
| 68 | |
| 69 | -F:: |
Junio C Hamano | 7cc9129 | 2008-09-20 16:55:38 | [diff] [blame] | 70 | Pass the `--no-reuse-object` option to `git-pack-objects`, see |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 71 | linkgit:git-pack-objects[1]. |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 72 | |
| 73 | -q:: |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 74 | Pass the `-q` option to 'git pack-objects'. See |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 75 | linkgit:git-pack-objects[1]. |
Junio C Hamano | 7e9f6b7 | 2006-02-22 10:44:55 | [diff] [blame] | 76 | |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 77 | -n:: |
Junio C Hamano | b713ff1 | 2008-05-24 01:12:30 | [diff] [blame] | 78 | Do not update the server information with |
Junio C Hamano | 1aa40d2 | 2010-01-21 17:46:43 | [diff] [blame] | 79 | 'git update-server-info'. This option skips |
Junio C Hamano | b713ff1 | 2008-05-24 01:12:30 | [diff] [blame] | 80 | updating local catalog files needed to publish |
| 81 | this repository (or a direct copy of it) |
Junio C Hamano | ba4b928 | 2008-07-06 05:20:31 | [diff] [blame] | 82 | over HTTP or FTP. See linkgit:git-update-server-info[1]. |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 83 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 84 | --window=<n>:: |
| 85 | --depth=<n>:: |
Junio C Hamano | 93567a6 | 2006-10-08 08:47:56 | [diff] [blame] | 86 | These two options affect how the objects contained in the pack are |
Junio C Hamano | 3eb513f | 2006-09-18 02:47:16 | [diff] [blame] | 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. |
Junio C Hamano | 91d44c5 | 2007-05-09 07:16:07 | [diff] [blame] | 93 | The default value for --window is 10 and --depth is 50. |
Junio C Hamano | 3eb513f | 2006-09-18 02:47:16 | [diff] [blame] | 94 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 95 | --window-memory=<n>:: |
Junio C Hamano | 235d53f | 2007-07-13 00:25:15 | [diff] [blame] | 96 | This option provides an additional limit on top of `--window`; |
| 97 | the window size will dynamically scale down so as to not take |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 98 | up more than '<n>' bytes in memory. This is useful in |
Junio C Hamano | 235d53f | 2007-07-13 00:25:15 | [diff] [blame] | 99 | repositories with a mix of large and small objects to not run |
| 100 | out of memory with a large window, but still be able to take |
| 101 | advantage of the large window for the smaller objects. The |
| 102 | size can be suffixed with "k", "m", or "g". |
| 103 | `--window-memory=0` makes memory usage unlimited, which is the |
| 104 | default. |
| 105 | |
Junio C Hamano | d2179ef | 2010-10-22 04:12:17 | [diff] [blame] | 106 | --max-pack-size=<n>:: |
Junio C Hamano | 4d97958 | 2010-02-04 06:27:29 | [diff] [blame] | 107 | Maximum size of each output pack file. The size can be suffixed with |
| 108 | "k", "m", or "g". The minimum size allowed is limited to 1 MiB. |
Junio C Hamano | 74fd0fc | 2016-05-10 21:23:56 | [diff] [blame] | 109 | If specified, multiple packfiles may be created, which also |
| 110 | prevents the creation of a bitmap index. |
Junio C Hamano | 4d97958 | 2010-02-04 06:27:29 | [diff] [blame] | 111 | The default is unlimited, unless the config variable |
| 112 | `pack.packSizeLimit` is set. |
Junio C Hamano | 591dc6a | 2007-05-29 09:18:19 | [diff] [blame] | 113 | |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 114 | -b:: |
| 115 | --write-bitmap-index:: |
| 116 | Write a reachability bitmap index as part of the repack. This |
| 117 | only makes sense when used with `-a` or `-A`, as the bitmaps |
| 118 | must be able to refer to all reachable objects. This option |
Junio C Hamano | 74fd0fc | 2016-05-10 21:23:56 | [diff] [blame] | 119 | overrides the setting of `repack.writeBitmaps`. This option |
| 120 | has no effect if multiple packfiles are created. |
Junio C Hamano | 5b3533d | 2014-02-27 23:07:15 | [diff] [blame] | 121 | |
Junio C Hamano | 3b0cdc2 | 2014-03-18 22:06:16 | [diff] [blame] | 122 | --pack-kept-objects:: |
| 123 | Include objects in `.keep` files when repacking. Note that we |
| 124 | still do not delete `.keep` packs after `pack-objects` finishes. |
| 125 | This means that we may duplicate objects, but this makes the |
| 126 | option safe to use when there are concurrent pushes or fetches. |
| 127 | This option is generally only useful if you are writing bitmaps |
Junio C Hamano | 74fd0fc | 2016-05-10 21:23:56 | [diff] [blame] | 128 | with `-b` or `repack.writeBitmaps`, as it ensures that the |
Junio C Hamano | 3b0cdc2 | 2014-03-18 22:06:16 | [diff] [blame] | 129 | bitmapped packfile has the necessary objects. |
Junio C Hamano | 3eb513f | 2006-09-18 02:47:16 | [diff] [blame] | 130 | |
Junio C Hamano | c6c919b | 2016-07-06 21:34:15 | [diff] [blame^] | 131 | --unpack-unreachable=<when>:: |
| 132 | When loosening unreachable objects, do not bother loosening any |
| 133 | objects older than `<when>`. This can be used to optimize out |
| 134 | the write of any objects that would be immediately pruned by |
| 135 | a follow-up `git prune`. |
| 136 | |
| 137 | -k:: |
| 138 | --keep-unreachable:: |
| 139 | When used with `-ad`, any unreachable objects from existing |
| 140 | packs will be appended to the end of the packfile instead of |
| 141 | being removed. In addition, any unreachable loose objects will |
| 142 | be packed (and their loose counterparts removed). |
| 143 | |
Junio C Hamano | 77b7e90 | 2006-10-23 07:18:50 | [diff] [blame] | 144 | Configuration |
| 145 | ------------- |
| 146 | |
Junio C Hamano | d330432 | 2010-02-05 03:28:27 | [diff] [blame] | 147 | By default, the command passes `--delta-base-offset` option to |
| 148 | 'git pack-objects'; this typically results in slightly smaller packs, |
| 149 | but the generated packs are incompatible with versions of Git older than |
| 150 | version 1.4.4. If you need to share your repository with such ancient Git |
Junio C Hamano | f85ef63 | 2016-02-17 22:31:06 | [diff] [blame] | 151 | versions, either directly or via the dumb http protocol, then you |
Junio C Hamano | d330432 | 2010-02-05 03:28:27 | [diff] [blame] | 152 | need to set the configuration variable `repack.UseDeltaBaseOffset` to |
| 153 | "false" and repack. Access from old Git versions over the native protocol |
| 154 | is unaffected by this option as the conversion is performed on the fly |
| 155 | as needed in that case. |
Junio C Hamano | 77b7e90 | 2006-10-23 07:18:50 | [diff] [blame] | 156 | |
Junio C Hamano | 9049d91 | 2008-05-29 02:09:50 | [diff] [blame] | 157 | SEE ALSO |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 158 | -------- |
Junio C Hamano | 35738e8 | 2008-01-07 07:55:46 | [diff] [blame] | 159 | linkgit:git-pack-objects[1] |
| 160 | linkgit:git-prune-packed[1] |
Junio C Hamano | 1a4e841 | 2005-12-27 08:17:23 | [diff] [blame] | 161 | |
| 162 | GIT |
| 163 | --- |
Junio C Hamano | f7c042d | 2008-06-06 22:50:53 | [diff] [blame] | 164 | Part of the linkgit:git[1] suite |