| 用法 | git pack-refs --all --prune |
|---|---|
| 效果 | 引用集中存储,遍历更快 |
| 自动 | git gc 通常包含该步骤;maintenance 的 pack-refs 任务可定期执行 |
常用示例
常用示例
git pack-refs --all --prune
ls .git/refs/heads | head
git show-ref | wc -lCI 大量拉取标签的仓库收益明显;执行后如出现引用异常,packed-refs 可安全重建。
分支与标签数量多时,松散引用文件会让引用遍历变慢:git pack-refs --all --prune 把引用打包进 packed-refs,是低风险的基础维护。
| 用法 | git pack-refs --all --prune |
|---|---|
| 效果 | 引用集中存储,遍历更快 |
| 自动 | git gc 通常包含该步骤;maintenance 的 pack-refs 任务可定期执行 |
git pack-refs --all --prune
ls .git/refs/heads | head
git show-ref | wc -l