使用存储库维护和创作工具
Repository Maintenance… 显示对象数据库的大小并运行检查它或使历史记录和状态更快的任务。 Merge Author Identities… 写入 .mailmap 行,以便具有多个姓名或电子邮件的人显示为一位作者。
免费已更新
免费使用 GitTree:登录后的所有本地 Git 功能。
开始之前
- 在 GitTree 中打开的存储库。在您启动之前什么都不会运行。
在哪里可以找到它
- 命令面板:Repository Maintenance… 和 Merge Author Identities…。
| 行动 | macOS | Windows 和 Linux |
|---|---|---|
| 命令面板 | ⌘⇧P | Ctrl+Shift+P |
步骤
读取计数
打开Repository Maintenance…。 Object database 显示其 Size on disk、Loose objects、Packs 和任何 Stray files。
检查完整性
Check integrity 下的 Check 运行
git fsck以查找丢失或损坏的对象。它什么也改变不了。加快速度
运行下表中您需要的任务。每个在运行之前都会说明它会改变什么。
预期结果
检查存储库,其历史记录、引用和状态加载速度更快。
维护任务
| 任务 | 它的作用 |
|---|---|
| Speed up history | 写入提交图文件,以便图和历史加载得更快。 |
| Keep the commit-graph fresh | 设置 fetch.writeCommitGraph=true,因此每次提取都会更新它。 |
| Pack references | 将松散的分支和标记引用移至一个文件中。 |
| Speed up status | 设置 core.untrackedCache=true 并构建缓存。 |
Merge Author Identities…:选择Keep this identity,然后选择Show these as the kept identity下的同一个人的身份,然后按Merge Identities。提交 .mailmap 以共享它。
如果出现问题
“无法读取对象计数。”
关闭使用存储库的其他程序并再次打开该对话框;如果问题仍然存在,请运行 Check integrity。
问题
.mailmap 会重写历史吗?
不会。它只会改变名称的显示方式;每次提交都会保留其作者。