← 返回命令列表

Linux command

git-repack 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Repack objects

git repack

Repack aggressively

git repack -a -d

Repack with delta compression

git repack -a -d --depth=[250] --window=[250]

Repack all objects

git repack -A -d

Repack with geometry

git repack --geometric=[2]

说明

git repack consolidates loose objects into pack files, improving storage efficiency and access time. It reorganizes the repository's object database by combining individual loose objects into compressed packs. Repacking is useful after many small commits or after importing objects. The `-a -d` combination is common for aggressive repacking that removes redundant packs.

参数

-a
Pack all objects.
-A
Pack all reachable objects.
-d
Remove redundant packs.
-f
Force delta recomputation.
--depth _n_
Delta chain depth.
--window _n_
Delta window size.
--geometric _factor_
Geometric repacking.
-l
Local objects only.

FAQ

What is the git-repack command used for?

git repack consolidates loose objects into pack files, improving storage efficiency and access time. It reorganizes the repository's object database by combining individual loose objects into compressed packs. Repacking is useful after many small commits or after importing objects. The `-a -d` combination is common for aggressive repacking that removes redundant packs.

How do I run a basic git-repack example?

Run `git repack` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a do in git-repack?

Pack all objects.