Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

Pro Git Scott Chacon

Visit to download the full and correct content document:


https://ebookmass.com/product/pro-git-scott-chacon/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Willow Scott

https://ebookmass.com/product/willow-scott/

Mastering ArcGIS Pro, 2e Price

https://ebookmass.com/product/mastering-arcgis-pro-2e-price/

Logic Pro X 10.4 – Apple Pro Training Series:


Professional Music Production – Ebook PDF Version

https://ebookmass.com/product/logic-pro-x-10-4-apple-pro-
training-series-professional-music-production-ebook-pdf-version/

Chase Taylor K. Scott

https://ebookmass.com/product/chase-taylor-k-scott/
Defectors Erik R. Scott

https://ebookmass.com/product/defectors-erik-r-scott/

Socialism Scott R. Sehon

https://ebookmass.com/product/socialism-scott-r-sehon/

Island Criminology John Scott

https://ebookmass.com/product/island-criminology-john-scott/

Beginning Git and GitHub: Version Control, Project


Management and Teamwork for the New Developer, 2nd
Edition Tsitoara

https://ebookmass.com/product/beginning-git-and-github-version-
control-project-management-and-teamwork-for-the-new-
developer-2nd-edition-tsitoara/

Pro Power BI Architecture 2nd Edition Reza Rad

https://ebookmass.com/product/pro-power-bi-architecture-2nd-
edition-reza-rad/
Pro Git
Scott Chacon, Ben Straub

版本 2.1.65-3-ga7baa05f, 2023-12-28
目录
许可证 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Scott Chacon 序 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Ben Straub 序 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
献辞 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
贡献者 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
引言 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
起步 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
关于版本控制 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Git 简史 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Git 是什么? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
命令行 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
安装 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
初次运行 Git 前的配置. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
获取帮助 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Git 基础 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
获取 Git 仓库. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
记录每次更新到仓库 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
查看提交历史 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
撤消操作 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
远程仓库的使用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
打标签 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Git 别名 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Git 分支 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
分支简介 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
分支的新建与合并 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
分支管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
分支开发工作流 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
远程分支 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
变基 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
服务器上的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
协议 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
在服务器上搭建 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
生成 SSH 公钥 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
配置服务器 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Git 守护进程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Smart HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
GitWeb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
GitLab . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
第三方托管的选择 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
分布式 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
分布式工作流程 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
向一个项目贡献 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
维护项目 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
GitHub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
账户的创建和配置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
对项目做出贡献 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
维护项目 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
管理组织 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
脚本 GitHub . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
Git 工具 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
选择修订版本 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
交互式暂存 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
贮藏与清理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
签署工作 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
搜索 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
重写历史 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
重置揭密 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
高级合并 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
Rerere . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
使用 Git 调试 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
子模块 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
打包 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
替换 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
凭证存储 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
自定义 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
配置 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
Git 属性 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Git 钩子 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
使用强制策略的一个例子 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
Git 与其他系统 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
作为客户端的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
迁移到 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414
Git 内部原理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
底层命令与上层命令 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Git 对象 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
Git 引用 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
包文件 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
引用规范 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
传输协议 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
维护与数据恢复 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
环境变量 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 453
附录 A: 在其它环境中使用 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
图形界面 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Visual Studio 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
Visual Studio Code 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Eclipse 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
Sublime Text 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Bash 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Zsh 中的 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Git 在 PowerShell 中使用 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
总结 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
附录 B: 在你的应用中嵌入 Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
命令行 Git 方式. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Libgit2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
JGit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
go-git. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
Dulwich. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
附录 C: Git 命令 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
设置与配置 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
获取与创建项目 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
快照基础 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
分支与合并 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
项目分享与更新 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
检查与比较 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
调试 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
补丁 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
邮件 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
外部系统 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
管理 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
底层命令 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492
索引 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
许可证
本作品在“创作共用 署名-非商业性使用-相同方式共享 3.0 未本地化版本 (CC BY-NC-SA 3.0)”许可协议下授权。
要阅览该许可的副本,请访问 https://creativecommons.org/licenses/by-nc-sa/3.0/deed.zh 或者写信向
Creative Commons, PO Box 1866, Mountain View, CA 94042, USA 获取。

1
Scott Chacon 序
欢迎来到 Pro Git 第二版。 第一版出版到现在已经过去了四年。 到今天,Git 虽然出现了许多改变,但是还有很
多重要的事情一如昨日。 因为 Git 核心团队对保持向后兼容性异常固执,所以直到今天大多数核心命令与概念依
然有效,但是围绕 Git 的社区还是有一些重大的增加与改变。 本书的第二版就是为了更新书籍并讲解那些改动以
使其对新用户更有帮助。

当我写第一版时,Git 对于超级黑客来说还是一个相对难用,只能勉强接受的工具。 它开始在特定的社区中快速


发展,但是还没有达到像今天一样无处不在的地步。 自那时起,几乎每一个开源社区都采用了它。 Git 在
Windows 上取得了难以置信的进步,包括所有平台的图形用户界面对它的支持、IDE 的支持,以及商业使用的
爆炸式发展。 四年前的 Pro Git 对此一无所知。 新版本的主要目标之一就是涉及 Git 社区中那些所有新的前沿领
域。

使用 Git 的开源社区也呈现出爆炸式的发展。 大概在五年前吧,我坐下来写这本书时(写完第一个版本花了我不


少时间),我开始在一个知名度极小的开发 Git 托管网站的公司工作,这家公司就是 GitHub。 本书出版时大概
有几千人在使用 GitHub 网站,而为其工作的只有我们四个人。 在我写这篇介绍时,GitHub 宣布我们托管了
1000 万个项目、拥有大概 500 万注册开发者账户与大概 230 名员工。 爱它也好,恨它也罢,当我坐下来写第一
版时,GitHub 以一种意想不到的方式猛烈地改变了一大批开源社区。

我在 Pro Git 的原始版本中写了一节我并不是很满意的内容,是作为和提供 Git 托管服务相关的例子的 GitHub。


我在书里写的东西本质上都是和社区有关的,但是又不得不讨论到我的公司,这点我不喜欢。 虽然我还是不喜
欢这种利益冲突,但 GitHub 在 Git 社区的重要性是不能回避的。 我已经决定将本书中关于 GitHub 的部分转变
为深度介绍 GitHub 是什么以及如何高效地使用它,而不再是作为一个 Git 托管的例子。 如果你正学习如何使用
Git,那么了解如何使用 GitHub 将会帮助你加入到一个巨大的社区中。不论你决定为自己的代码使用哪一个 Git
托管服务,这都很有价值。

自从上次出版以来另一个重大变革是 Git 网络传输 HTTP 协议的开发与崛起。书中的大多数例子都已经从 SSH


切换到 HTTP,因为它更简单。

在过去这几年看到 Git 从一个相对无名的版本管理系统成长为商业与开源版本管理的事实标准是令人吃惊的。我


很高兴 Pro Git 做得很好并已经成为市场上几本既成功又完全开源的技术书籍之一。

我希望你能享受这个升级版的 Pro Git。

2
Ben Straub 序
本书的第一版就是将我与 Git 结下不解之缘的原因。书中采用的是我引进的做软件的风格,这种风格比我之前看
到的任何事情都要自然。那时我已经做了好几年开发者了,但是这本书将我指引到一条更加精彩的道路上。

几年之后的现在,我是 Git 的一个主要实现的贡献者,我在最大的 Git 托管公司工作,我已经环游世界教人们使


用 Git。当 Scott 问我是否有兴趣在第二版上工作时,我甚至连想都没想就答应了。

能在这本书上工作是一份巨大的快乐与荣耀。我希望它能像帮助我一样帮助你。

3
献辞
致我的妻子,Becky,没有她的话这段冒险不会开始。—— Ben

谨以此书献给我的家人。 给这些年一直支持着我的妻子 Jessica 和女儿 Josephine, 还有那些在我风烛残年之


时还能支持我的人。—— Scott

4
贡献者
因为这是一本开源书籍,这几年我们获得了捐赠的若干勘误表与内容修改。 下面是将 ProGit 英文版作为开源项
目贡献的所有人员。 感谢你们帮助将这本书变成对每一个人都更好的书。

4wk- KatDwo William


Turrell
8loser Katrin Leinweber Wisp Zhan
Adam Laflamme Kausar Mehmood WispZhan
Adrien Ollier Keith Hill Wlodek
Bzyl
Akrom K Kenneth Kin Lum Xavier
Bonaventura
Alan Klaus Frank Y. Z. Chen
Alan Wang Kristijan "Fremen" Velkovski Yann
Soubeyrand
Albert Krzysztof Szumny Yedda
Aleh Suprunovich Kyrylo Yatsenko Yue Lin Ho
Alexander Bezzubov Lars Vogel Yunbin Liu
Alexandre Garnier Laxman Yunhai Luo
Alfred Myers Lazar95 Yusuke
SATO
Amanda Dillon Leonard Laszlo Zheeeng
Andrei Dascalu Lin Hsu ajax333221
Andrew Layman Linus Heckemann alamier
Andrew MacFie Liu Lantao albert
Andrew Metcalf Logan Hasson alex-
koziell
Andrew Murphy Louise Corrigan allen
joslin
AndyGee Luc Morin anguiao
AnneTheAgile Lukas Röllin atalakam
Anthony Loiseau Marcin Sędłak-Jakubowski axmbo
Anton Trunov Marie-Helene Burle banxi1988
Antonello Piemonte Marius Žilėnas bob
Antonino Ingargiola Markus KARG branchzero
Atul Varma Marti Bolivar bripmccann
Awc Cho Mashrur Mia (Sa'ad) brotherben
Ben Sima Masood Fallahpoor cangyin
Benjamin Dopplinger Mathieu Dubreuilh chen
Bill Zhao Matthew Miner chengz
Borek Bernard Matthieu Moy curiositer
BranchZero Sun Michael MacAskill delta4d
Brett Cannon Michael Sheaver devwebcl
Buzut Michael Welch dualsky
C Nguyen Michiel van der Wulp evanderiel
Cadel Watson Mike Charles eyherabh
CaoWeiwei Mike Pennisi flip111

5
Carlos Martín Nieto Mike Thibodeau
flyingzumwalt
Carlos Tafur Moriaty0o0 goekboet
Chaitanya Gurrapu Niels Widger grgbnc
Changwoo Park Nils Reuße guan wang
Cheng Liang Oling Cat haripetrov
ChrisChan2015 Olleg Samoylov hasan
Christoph Prokop Owen
hasban12138
Christopher Wilson Pablo Schläpfer i-give-up
Chuckie Chen Pascal Berger ijessie
CodingSpiderFox Pascal Borreli iprok
Cory Donnelly Patrick Steinhardt jckling
Cullen Rhodes Pavel Janík jingsam
Cyril Paweł Krupiński johnhar
Damien Tournoud Perry
laggardkernel
Dan Schmidt Peter Kokot leo
Daniel Shahaf Phil Mitchell leo108
Daniel Sturm Philippe Blain leshiv
Daniele Tricoli Philippe Miossec lilydjwg
Daniil Larionov Qiu Chaofan lingr7
Danny Lin Rafi liuxilu
David Rogers Raphael R liwenzhuo
Davide Angelocola Ray Chen ljporljp
Denis Savitskiy Razon Yang luozexuan
Dexter Rei maks
Dexter Morganov Rex Kerr marjune
DiamondeX Reza Ahmadi mmikeww
Dieter Ziller Richard Hoyle
moonlitusun
Dino Karic Ricky Senft morstar
Dmitri Tikhonov Rintze M. Zelle
mosdalsvsocld
Dmitriy Smirnov Rob Blanco
mowangjuanzi
Duncan Dean Robert P. Goldman myd7349
Eden Hochbaum Robert P. J. Day neo1218
Eric Henziger Rohan D'Souza networm
Excimer Gong Roman Kosenko nicktime
Explorare Ronald Wampler omvjro
Ezra Buehler Ryan Yin ousugo
Felix Nehrke Rüdiger Herrmann patrick96
Feng Hao SATO Yusuke paveljanik
Filip Kucharczyk Sam Ford
pedrorijo91
Fornost461 Sam Joseph
peterwwillis
Frank Sanders Kleinfeld petsuter

6
Frederico Mazzone Sarah Schneider pityonline
Frej Drejhammar Saurav Sachidanand puxiao
Gc Scott Bronson rahrah
Geno1024 Sean Head rmzelle
Gerry Sebastian Krause roife
Guthrie McAfee Armstrong Severino Lorilla Jr root
HairyFotr Shengbin Meng
sanders@oreilly.com
Hamidreza Mahdavipanah Shi Yan secondwtq
Hao Gu Siarhei Bobryk shukebeta
Haruo Nakayama Siarhei Krukau
shutaozhenzhen
Helmut K. C. Tessarek SkyBlueEE
spacewander
Hidde de Vries Skyper td2014
HonkingGoose Snehal Shekatkar twekberg
Howard Song Li uerdogan
IceNature Stephan van Maris un1versal
Ignacy Steve ZHANG wang yuchi
Ilker Cat Steve Zhang wangfpp
Jan Groenewald Steven Roddis xJom
Jason SudarsanGP xtreak
Jaswinder Singh Suhaib Mujahid yakirwin
Jean-Noël Avila Sven Selberg yikakia
Jeroen Oortwijn Thanix yikang
Jim Hill Thomas Ackermann yionr
Jimgao Thomas Hartmann zhch
Jinbao Zhang Tom Schady zhou
Joel Davies Tomoki Aonuma zwPapEr
Johannes Dewender Tong Hui ᐯᕮᒪᗝᑕᕮᒣ
Johannes Schindelin Tony Joseph 刘方杰
John Lin Tvirus 啊咪咪小熊
Jon Forrest Tyler Cipriani 夏恺(Xia
Kai)
Jon Freed Ud Yzr 晓荷
Jordan Hayashi Vadim Markovtsev 狂飙
Joris Valette Vangelis Katsikaros 狄卢
Josh Byster Victor Ma 王顶
Joshua Webb Vitaly Kuznetsov 诺墨
Jun Shaw WQR1994 谭九鼎
Junjie Yuan Weisi Dai 非法操作
Justin Clift Whitebox 靳阳
Kaartic Sivaraam William Gathoye

表格 1. 简体中文贡献者
章节 译者 审校者
1. 起步

7
章节 译者 审校者
1.1 关于版本控制 @Lax 许伟程
1.2 Git 简史 @Lax
1.3 Git 基础 @Lax @Geno1024
1.4 命令行 @hbrls @spacewander
1.5 安装 Git @Lax 许伟程
1.6 初次运行 Git 前的配置 @networm @xinqiu @robinwen @ahlijin 许伟程
1.7 获取帮助 @Lax
1.8 总结 @Lax @devbean
2. Git 基础
2.1 获取 Git 仓库 @alamier @networm
2.2 记录每次更新到仓库 @alamier @networm 许伟程
2.3 查看提交历史 @alamier 许伟程
2.4 撤消操作 @networm @pktangyue @robinwen @ahlijin
2.5 远程仓库的使用 @networm @pktangyue @ahlijin @wych42
2.6 打标签 @networm @pktangyue @wych42 @robinwen
2.7 Git 别名 @networm @pktangyue @wych42 @robinwen
2.8 总结 @alamier
3. Git 分支
3.1 分支简介 @archermind
3.2 分支的新建与合并 @archermind @zwpaper @wych42 @robinwen @networm
3.3 分支管理 @networm @zwpaper @wych42 @robinwen
3.4 分支开发工作流 @archermind @xinqiu @wych42 @zwpaper
3.5 远程分支 @networm @wych42 @zwpaper @robinwen
3.6 变基 @hbrls @Albert @networm
3.7 总结 Jun995@GitH
ub
4. 服务器上的 Git
4.1 协议 @wych42 @Geno1024 王波 @xinqiu @morefreeze
4.2 在服务器上搭建 Git @neo1218 @Geno1024 王波 @xinqiu
4.3 生成 SSH 公钥 @oranzhang @secondwtq @IceNature @jeffsui
4.4 配置服务器 @oranzhang @Geno1024 @IceNature @secondwtq
4.5 Git 守护进程 @branchzero @networm @IceNature @morefreeze
4.6 Smart HTTP @branchzero 许伟程 @IceNature @morefreeze
4.7 GitWeb 许伟程 @networm @IceNature 王波
4.8 GitLab @neo1218 @IceNature @jeffsui @networm

8
章节 译者 审校者
4.9 第三方托管的选择 @branchzero 许伟程 @networm @IceNature
4.10 总结 @8loser
5. 分布式 Git
5.1 分布式工作流程 @leshiv @secondwtq @summershrimp @IceNature
5.2 向一个项目贡献 @networm @secondwtq @IceNature @morefreeze
5.3 维护项目 @secondwtq @IceNature @morefreeze 王波
5.4 总结 @xiaket @summershrimp @IceNature @vangie
6. GitHub
6.1 账户的创建和配置 @devbean @branchzero @buginux @IceNature
6.2 对项目做出贡献 许伟程 @branchzero @buginux @IceNature
6.3 维护项目 @qinglangee @branchzero @polarlights @IceNature
6.4 管理组织 @zwpaper @Geno1024 @branchzero @secondwtq
6.5 脚本 GitHub @networm @Geno1024 @branchzero @IceNature
6.6 总结 @devbean @branchzero @buginux @IceNature
7. Git 工具
7.1 选择修订版本 @leo108 王波
7.2 交互式暂存 @networm @IceNature @jeffsui @M1seRy
7.3 储藏与清理 @networm @IceNature @Geno1024 @M1seRy
7.4 签署工作 @networm @IceNature @tvvocold @Geno1024
7.5 搜索 @leo108 王波
7.6 重写历史 @networm @Kyle-ak @IceNature @Geno1024
7.7 重置揭密 @networm @IceNature @Geno1024 @OlingCat
7.8 高级合并 @networm @IceNature @Geno1024 @jeffsui
7.9 Rerere @networm @Geno1024 @IceNature @jeffsui
7.10 使用 Git 调试 @leo108 王波
7.11 子模块 @networm @IceNature @Geno1024 @OlingCat
7.12 打包 @networm @xff2016 @Geno1024 @IceNature
7.13 替换 @Gnahceg @xff2016 @Geno1024 @IceNature @oldsharp 王波
7.14 凭证存储 @leo108
7.15 总结 @leo108
8. 自定义 Git
8.1 配置 Git @spacewand @neo1218 @IceNature @branchzero
er
8.2 Git 属性 @spacewand @IceNature @secondwtq @oldsharp
er

9
章节 译者 审校者
8.3 Git 钩子 @spacewand @IceNature @M1seRy @secondwtq
er
8.4 使用强制策略的一个例子 @spacewand @gisphm @IceNature @M1seRy
er
8.5 总结 @spacewand @devbean @networm @IceNature
er
9. Git 与其他系统
9.1 作为客户端的 Git @networm @IceNature @Geno1024 @KevenYoung @secondwtq
@branchzero 许伟程
9.2 迁移到 Git @networm @IceNature @Geno1024 @youngWM 许伟程
9.3 总结 @networm @IceNature @KevenYoung @Geno1024
10. Git 内部原理
10.1 底层命令和高层命令 @oldsharp
10.2 Git 对象 @oldsharp @networm @ZKHelloworld @OlingCat
10.3 Git 引用 @oldsharp @devbean @networm @ZKHelloworld
10.4 包文件 @zwpaper @oldsharp @robinwen @IceNature
10.5 引用规范 @morstar @networm @oldsharp @robinwen
10.6 传输协议 @zwpaper @byr-gdp @robinwen @IceNature
10.7 维护与数据恢复 @networm 许伟程 @IceNature @Geno1024
10.8 环境变量 @qinglangee @vangie @IceNature @jeffsui
10.9 总结 @oldsharp @branchzero
A1. 其它环境中的 Git
A1.1 图形界面 @hbrls @IceNature
A1.2 Visual Studio 中的 Git @liwenzhuo @devbean @IceNature @Geno1024
A1.3 Visual Studio Code 中的 @Asurada @networm
Git
A1.4 Eclipse 中的 Git @WispZhan @IceNature @Geno1024 许伟程
A1.5 IntelliJ / PyCharm / @Asurada @networm
WebStorm / PhpStorm /
RubyMine 中的 Git
A1.6 Sublime Text 中的 Git @Asurada @networm
A1.7 Bash 中的 Git @WispZhan @IceNature @Geno1024 @neo1218
A1.8 Zsh 中的 Git @branchzero @IceNature @Geno1024 @polarlights
A1.9 Powershell 中的 Git @branchzero @IceNature @Geno1024 许伟程
A1.10 总结 @networm @IceNature @Geno1024 许伟程
A2. 将 Git 嵌入你的应用
A2.1 命令行 Git 方式 @Geno1024
A2.2 Libgit2 @Geno1024 @IceNature @fatjyc @branchzero

10
章节 译者 审校者
A2.3 JGit @Geno1024 @IceNature @fatjyc @branchzero
A3. Git 命令 @banxi1988 @peizh @IceNature @byr-gdp
A3.1 设置与配置 @banxi1988 @peizh @IceNature @byr-gd
A3.2 获取与创建项目 @banxi1988 @peizh @IceNature @byr-gd
A3.3 快照基础 @banxi1988 @peizh @IceNature @byr-gd
A3.4 分支与合并 @banxi1988 @peizh @IceNature @byr-gd
A3.5 项目分享与更新 @banxi1988 @peizh @IceNature @byr-gd
A3.6 检查与比较 @banxi1988 @peizh @IceNature @byr-gd
A3.7 调试 @banxi1988 @peizh @IceNature @byr-gd
A3.8 补丁 @banxi1988 @peizh @IceNature @byr-gd
A3.9 邮件 @banxi1988 @peizh @IceNature @byr-gd
A3.10 外部系统 @banxi1988 @peizh @IceNature @byr-gd
A3.11 管理 @banxi1988 @peizh @IceNature @byr-gd
A3.12 底层命令 @banxi1988 @peizh @IceNature @byr-gd

Coding.NET 也有审校贡献: 杜万 tvvocold 郑铿宏 杨臻 张一白 周延 江裕诚 许坦 刘元恺

11
引言
你将花费你生命中的若干小时来阅读有关 Git 的相关内容。 让我们用几分钟时间来介绍下我们将给你讲解的内
容。 下面是本书正文十章和附录三章的快速总结。

在 第一章 ,我们将介绍版本控制系统(VCSs)和 Git 的基本概念——不涉及技术内容,仅仅是什么是 Git, 为什


么它会成为 VCSs 大家庭中的一员,它与其它 VCSs 的区别,以及为什么那么多人都在使用 Git。 然后,我们将
介绍如何下载 Git 以及如果你的系统没有安装 Git,如何为第一次运行做准备。

在 第二章 ,我们将阐述 Git 的基本使用——包含你在使用 Git 时可能遇到的 80% 的情形。 通过阅读本章,你应


该能够克隆仓库、查看项目历史、修改文件和贡献更改。 如果本书在此刻自燃,你应该已经能够使用已经学到
的漂亮有用的 Git 知识获取到另外一份拷贝。

第三章 关注于 Git 的分支模型。分支模型通常被认为是 Git 的杀手级特性。 这里,你将学习到究竟是什么让 Git


与众不同。学习完本章,你可能需要一段时间来思考, 在 Git 分支成为你的生活的一部分之前,你到底是如何生
活的。

第四章 关注于服务器端的 Git。本章面向那些希望在你自己的组织或个人服务器搭建用于合作的 Git 的读者。 如


果你希望让别人处理这些事务,我们也会探讨一些托管选项。

第五章 将阐述多种分布式工作流的细节,以及如何使用 Git 实现它们。 学习完本章,你应该能够在多个远程仓


库之间游刃有余,通过电子邮件使用 Git, 熟练地处理多个远程分支和合作者贡献的补丁。

第六章 介绍 GitHub 托管服务以及深层次的工具。我们将涵盖注册与账户管理, 创建和使用 Git 仓库,贡献项目


的普通工作流以及接受他人的贡献,GitHub 的可编程接口和那些能够让你的生活变得更简单的小技巧。

第七章 关于 Git 的高级命令。你将学习到一些高级主题,诸如掌握可怕的“reset”命令, 使用二分搜索识别错


误,编辑历史,细节版本选择等等。本章的介绍将丰富你的 Git 知识,让你成为一个真正的大师。

第八章 关于 Git 环境的自定义配置,包括设置用于增强或促进自定义策略的钩子脚本, 以及按照你所需要的方


式进行工作的环境配置。我们还会介绍构建你自己的脚本集,以增强自定义提交策略。

第九章 对比 Git 和其它 VCSs,包括在 Subversion(SVN)的世界使用 Git 以及从其它 VCSs 迁移到 Git。 很多组
织仍在使用 SVN,并且也没有计划改变,此时,你将了解到 Git 不可思议的能力——本章将展示, 在你不得不使
用 SVN 服务器的时候如何协同合作。我们还将介绍如何从不同系统导入项目, 以便你能够全身心投入 Git 的怀
抱。

第十章 深入 Git 隐晦而漂亮的实现细节。现在,你已经知道所有有关 Git 的知识, 能够熟练运用 Git 的强大优雅


的功能。接下来,你可以继续学习 Git 如何存储对象、 Git 的对象模型是怎样的、打包文件的细节、服务器协议
等更多知识。 本书自始至终都将引用本章的内容,以便你能够在当时就可以深入了解。 但是,如果你像我们一
样希望深入学习技术细节,你可能想先阅读第十章。我们将选择权交给你。

在 附录 A ,我们学习多个在特定环境中使用 Git 的实例。 我们涵盖了许多不同的 GUI 和 IDE 编程环境,你可能


会想在这些环境中使用 Git,以及你可以使用哪些环境。 如果你想在 shell、IDE 或文本编辑器中使用 Git,请阅
读本章。

在 附录 B ,我们探讨通过类似 libgit2 和 JGit 的工具编写 Git 脚本、扩展 Git。 如果你对编写复杂、快速的自定


义工具感兴趣,需要了解 Git 的底层访问,本章就是你所需要了解的。

12
最后在 附录 C ,我们一次性浏览 Git 的所有主要命令,复习在本书中介绍的内容,
回忆我们能够使用这些命令做什么。如果你需要知道本书中我们使用了哪些特定 Git 命令,你可以在这里查阅。

下面让我们开始吧。

13
起步
本章为 Git 入门。 我们从介绍版本控制工具的背景知识开始,然后讲解如何在你的系统上运行 Git,最后是关于
如何设置 Git 以便开始工作。 通过本章的学习,你应该能了解为什么 Git 这么流行,为什么你应该使用 Git 以及
你应该如何设置以便使用 Git。

关于版本控制
什么是“版本控制”?我为什么要关心它呢? 版本控制是一种记录一个或若干文件内容变化,以便将来查阅特
定版本修订情况的系统。 在本书所展示的例子中,我们对保存着软件源代码的文件作版本控制,但实际上,你
可以对任何类型的文件进行版本控制。

如果你是位图形或网页设计师,可能会需要保存某一幅图片或页面布局文件的所有修订版本(这或许是你非常渴
望拥有的功能),采用版本控制系统(VCS)是个明智的选择。 有了它你就可以将选定的文件回溯到之前的状
态,甚至将整个项目都回退到过去某个时间点的状态,你可以比较文件的变化细节,查出最后是谁修改了哪个地
方,从而找出导致怪异问题出现的原因,又是谁在何时报告了某个功能缺陷等等。 使用版本控制系统通常还意
味着,就算你乱来一气把整个项目中的文件改的改删的删,你也照样可以轻松恢复到原先的样子。 但额外增加
的工作量却微乎其微。

本地版本控制系统

许多人习惯用复制整个项目目录的方式来保存不同的版本,或许还会改名加上备份时间以示区别。 这么做唯一
的好处就是简单,但是特别容易犯错。 有时候会混淆所在的工作目录,一不小心会写错文件或者覆盖意想外的
文件。

为了解决这个问题,人们很久以前就开发了许多种本地版本控制系统,大多都是采用某种简单的数据库来记录文
件的历次更新差异。

14
图表 1. 本地版本控制.

其中最流行的一种叫做 RCS,现今许多计算机系统上都还看得到它的踪影。 RCS 的工作原理是在硬盘上保存补


丁集(补丁是指文件修订前后的变化);通过应用所有的补丁,可以重新计算出各个版本的文件内容。

集中化的版本控制系统

接下来人们又遇到一个问题,如何让在不同系统上的开发者协同工作? 于是,集中化的版本控制系统
(Centralized Version Control Systems,简称 CVCS)应运而生。 这类系统,诸如 CVS、Subversion 以及
Perforce 等,都有一个单一的集中管理的服务器,保存所有文件的修订版本,而协同工作的人们都通过客户端
连到这台服务器,取出最新的文件或者提交更新。 多年以来,这已成为版本控制系统的标准做法。

15
Another random document with
no related content on Scribd:
will make this one look like the last rose of summer. Leave the
hideous thing alone. Why, the Dromans will think that you are dippy.
Fact is, I believe that they are beginning to think so already."
"Let 'em!" said Rhodes with true philosophic indifference. "People
thought that Galileo was crazy, and Newton and Darwin; Columbus
was non compos mentis,[13] Fulton was dippy, and Edison was
looney. Yes, at one time the great inventor bore the beautiful
sobriquet of Looney Edison. Listen to me, Billy, me lad: the greatest
compliment that a scientist can ever receive is to be called a sap by
sapheads."
All that, I admitted, was very true and truly cogent in its place; but
this was not its place, and the Dromans certainly were neither
sapheads nor saps. To my relief, and, indeed to my surprise, I
dissuaded him from taking the thing as a specimen, and on we went
once more.
At length we left the stream, which went plunging into a most
fearsome place, into which no man could even dream of following it.
Soon after that, the descent became very steep. The going,
however, was good, and we went down at a rapid rate. This lasted
for two or three hours, and we had descended many hundreds of
feet. The slope then suddenly became gentle, and we were making
our way through a perfect maze of tortuous galleries and passages,
which at times opened out into halls and chambers.
The light was no longer in masses but in streams—streams that
crawled and shivered and shook, as though in it spirit-things were
immersed and were struggling to break from it. The fungal growths
were everywhere now. There were mushrooms with pilei bigger than
umbrellas. Shapes as grotesque as if seen through the eyes of
madness. There were growths, too, that one could almost think
beautiful, and masses hideous and slimy as so many octopi. A
strong and most unpleasant odor filled the place. And here and
there, almost everywhere in the strange fungoid growth, were things
creeping, crawling—things for which I can find no name, and for
some of them I am glad that I can not.
It was a weird scene, an indescribable scene, one horrible,
mysterious and yet strangely wonderful too. A place gloomy and
weird as any ever conceived by Dante or Doré. And through it
human forms were moving, and its stillness was broken by human
voices raised in song; and, moving with those human beings, those
inhabitants of a world as alien as that of Venus or of Mars, were
Rhodes and I, we two modern men from the great modern world
above—the wonderful, the awful world of the sun.
Of a sudden an exclamation rang out—an exclamation that stilled
the song on the instant, brought the party to an abrupt halt and the
bow of Ondonarkus and that of Zenvothunbro from the cases.
The exclamation had broken from Rhodes; he was pointing into the
gloom off to our right, a tense, expectant look on his face.
I peered with straining eyes, but I could see nothing there. A few
moments passed, and still nothing was seen. I then turned to
Rhodes to ask him what it was; but the words I was about to speak
were never uttered. Instead, I gave something like a cry and whirled
round. For a sound had come from out the fungoid growth and the
darkness behind us, a sound as if of a slimy thing moving, slipping.
Nothing, however, was to be seen there, and silence, utter silence,
had fallen upon the spot—silence abruptly broken by another
exclamation from Milton Rhodes.
"Great Heaven!" I cried as I whirled back to the direction in which he
was pointing. "They are all around us!"
"Look, Bill—look at that!"
I saw nothing for a second or two. And then, off in the darkness
beyond the reach of our lights, the darkness itself was moving—yes,
the very darkness itself.
"See that, Bill?"
I saw it. And the next instant I saw two great eyes, eyes that were
watching us. And those eyes were moving.
Chapter 31
"GOGRUGRON!"
They were visible for a few seconds only—those great eyes burning
with a greenish fire.
"Where did they go?" exclaimed Rhodes.
"And," said I, "what can it be? An ape-bat?"
"That is no ape-bat."
He turned to Ondonarkus.
"Loopmuke?" he queried.
No; it was not a loopmuke. But what it was neither Ondonarkus's
pantomime nor Drorathusa's could tell us.
"I don't think it's as bad as that. But the Dromans all know what it is
themselves."
"There!" I cried, whirling round. "Did you hear that, Milton? There's
that other thing again—that thing behind us!"
"I heard nothing."
"I heard something, I tell you. That mystery with the eyes is not the
only thing that is watching us, watching us and waiting."
Some moments passed, perhaps minutes, in expectant watching,
our glances incessantly darting about the cavern, through which the
light-mist was moving in troubled, writhing streams, the nebulous,
spectral glow of it seeming to enhance the fearsome gloom of that
dreadful place.
"I see nothing," Rhodes said at last, "and the cavern is as silent as a
tomb."
"But we are seen. And, if we don't get out of this, it may be our
tomb."
"I don't think it's as bad as that. But the Dromans are signing to us to
come on—let us hope to a place more pleasant than this one."
I had turned to quit the spot, my look, however, lingering in that
direction whence had come those low, mysterious sounds, a
direction right opposite to that in which the moving eyes had shone.
And scarcely had I taken a step forward when I fetched up, cried out
and pointed.
"See that! See it moving?"
A large fungus-tree, its form one indescribably grotesque, was
quivering. It began to shake violently. Some heavy body, hidden from
our eyes, was moving there, and it was moving toward us.
Of a sudden the tree was thrust far over, there was a squishy,
sickening sound, then down it came, the spot where it fell involved in
a cloud of phosphorescence, which thinned and faded in the air like
dust or mist as it settles.
"Shades of the Gorgons," I cried, "what is in there?"
A sound from Milton Rhodes turned me round on the instant.
"The eyes again!" he cried. "There they are. See them? Have we at
last got into Dante's Inferno itself?"
I was beginning to think that we had got into something worse.
Yes, there the eyes were, and they were nearer this time. But that
was all we saw, eyes and nothing more. The thing itself was hidden
in the fungoid growth and the shadows.
Rhodes raised his revolver, rested it on his left arm, took careful aim
and fired.
The report seemed to bellow like thunder through the cavern. There
was a scream from the Dromans, none of whom, save Drorathusa,
had ever heard a firearm before; and I doubt that even Drorathusa
knew what had killed her demon. On the instant, whilst the report of
the weapon and the cry of the Dromans were ringing in our ears,
came another sound; it was a shriek, high, piercing, unearthly, one
that seemed to arrest and curdle the very blood in our hearts.
It sank, ceased. But almost instantaneously it came again; it rose
until the air seemed to quiver to the sound.
The effect upon the Dromans was most sudden and pronounced.
A nameless fear, and something worse, seized upon me as I saw it.
They started from the spot as if in a panic, signing to us with frantic
gestures to follow.
I started; but Rhodes, for some inexplicable reason, stood there, his
look fixed on the spot whence came those demoniacal shrieks. The
eyes had disappeared, but in almost that very instant that I turned,
they shone again. I gazed at them as though in fascinated horror,
forgetting for the moment that there was something behind me.
Up the eyes rose. A black thing was visible there in the darkness, but
its shape was amorphous, mysterious. Up the eyes rose, seeming to
dilate, and the fire in them grew brighter and brighter, became so
unearthly that I began to wonder if I were going insane. The eyes
swayed, swayed back and forth for some moments, then gave a
sudden lurch into darkness. The shrieks broke, then came again,
more horrible, if that were possible, than before.
"Come on!" I cried, starting. "For Heaven's sake, Milton, let's get out
of this, or I'll go mad!"
"What in the world," said Rhodes, reluctantly turning to follow, "can
that thing be?"
"Let's get out of this hellish place. Let's do it before it's too late.
Remember, there is something behind us. Maybe monsters in other
directions too."
"Well," said Rhodes complacently as he followed along in my wake,
"we have our revolvers."
"Revolvers? Just see what your revolver has done. A revolver is only
a revolver, while that thing—who knows what that monster is?"
"The Dromans know, or at any rate, they think that they do."
"And look at the Dromans. Fear has them. Did you ever see fear like
that before? See how they are signing to us to come on. Even
Drorathusa is shaken to the very soul."
"After all, 'tis no wonder, Bill, that she is. Those shrieks! How can it
continue to shriek and shriek like that?"
Ere long we had come up with the Dromans, who at once quickened
their pace. On we went, casting apprehensive glances into the gloom
about us. Those frightful sounds sank as we moved onward. They
became faint, fainter still, and at last, to my profound thankfulness,
they were no longer to be heard, even when we paused to listen.
"If that," said I during one of those pauses, "is a good sample of what
we are to have here in Drome, then I wish that, instead of coming
down here, I had stepped into a den of cobras or something."
Drorathusa's eyes were upon me. As I ceased speaking, she raised
a hand and pointed in the direction whence we had come.
"Gogrugron!" she said.
And I saw fear and horror unutterable well up in her eyes as she said
it.
Chapter 32
"LEPRAYLYA!"
Steadily we made our way along and downward. The light-streams
were increasing in volume, the luminosity becoming stronger and
stronger, the vegetation more abundant, the weird shapes larger and
more unearthly than ever. The silence was broken by the drone of
insects—creatures meet inhabitants, forsooth, for a place so
indescribably strange and dreadful.
The cavern we were following was very tortuous, our route even
more so, what with the twists and turns which we had to make in
order to get through that phantasmagoria of fungal things. I do not
mean to say that all of those growths were horrible, but most of them
were, and some were as repulsive to the touch as they were to the
sight.
As we toiled our way through them, my heart was replete with dire
apprehension. I could not banish the vision of those great burning
eyes, the horror of those shrieks, which perhaps were still ringing
out. What if we were suddenly to find ourselves face to face with one
of those monsters (or more than one) here in this nightmare-forest?
Gogrugron! Gogrugron! What in the world was that monstrosity
known to the Dromans as a gogrugron? Well, most certainly, I was
not desirous of securing firsthand knowledge, upon that interesting
item, for the great science of natural history.
At length the light no longer lay in streams and rifts in the darkness,
but the darkness, instead, lay in streams through the light. The
Dromans quickened their already hurried pace, and there were
exclamations of "Drome! Drome!"
"Drome!" echoed Milton Rhodes. "I wonder what we are going to
find."
"Something wonderful," said I, "or something worse, perhaps, than
anything that we have seen."
Rhodes laughed, and I saw Drorathusa (Ondonarkus was leading
the way) turn and send a curious glance in our direction.
"Well," I added, "anything to get out of this horrible forest of fungi and
things."
Some minutes passed, perhaps a half-hour, perhaps only fifteen. Of
a sudden the great tunnel, now as light as a place on a sunless day,
gave a sharp turn to the right; a glad cry broke from the Hypogeans.
"Drome! Drome!" they cried.
We all hurried forward.
"Look!" I said as we reached the turn. "The mouth, the mouth! The
tunnel ends!"
There, but two hundred feet or so away, was the great yawning
mouth of it; nothing was visible through that opening, however, but
light, pearly, opalescent, mystic, beautiful.
"Drome!" cried Nandradelphis, clapping her hands.
A few moments, and we were standing at the entrance and gazing
out over the weird and beautiful scene.
"Drome!"
I turned at the sound and saw Drorathusa, her figure and mien
ineffably Sibylline and majestic, pointing out over the strange
landscape, her eyes on the face of Milton Rhodes.
"Drome," she said again.
"Drome," echoed Milton.
"I wonder, Bill, what this Drome really is. And I have an idea that this
is only the outskirts that we see. Can we at last be near our journey's
end, or is that end still far away?"
"Who can tell? This place seems to be a wilderness."
"Yes; a forest primeval."
"What," said I, "are we destined to find down there?"
"Things stranger, Bill, in all likelihood, than any explorer ever found
anywhere in that strange world above us."
"No gogrugrons, I hope."
Rhodes laughed.
"Gogrugron!" said Drorathusa.
And I saw that horror and fear again in her eyes.
The cavern had come out high up on a broken, jagged wall, which
went beetling up for hundreds of feet, up to the roof, which arched
away over the landscape before us. We were fully half a thousand
feet above the floor, which was a mass of luxuriant forest. Glimpses
were caught of a stream down to the left, possibly the one which we
had followed for so long. I judged the place to be over a mile wide;
Rhodes, however, thought that it was perhaps not quite a mile in the
widest part. Down this enormous cavern, the eye could range for
three or four miles, at which distance the misty light drew its veil over
the forest, the dark walls, and the roof arching across.
At times the light quivered and shook and there were strange
flickerings, and dartings of opalescent streaks through it—streaks
ineffably beautiful and yet, strangely enough, terrible too, terrible as
the blades of plunging swords in hands savage and murderous.
Once more Drorathusa raised a hand, and this time she pointed into
the misty distance.
"Le-prayl-ya!" she said.
Again her eyes were on Milton Rhodes, and, as she spoke that
name, I saw in those wondrous orbs of hers one of the strangest
looks that I have ever seen. I wondered if Rhodes too saw it. I found
his eyes upon Drorathusa, but there was in them so abstracted an
expression that I believed his thoughts were far away and that he
had not noticed. When I turned to Drorathusa again, it was to find
that that strange look was gone.
What a fascinating and mysterious creature this woman was!
"Lepraylya," she said again.
"Lepraylya," Milton nodded.
He looked at me.
"I wonder who or what this Lepraylya can be, Bill."
"King maybe."
"Queen, I hope," said Milton Rhodes.
He drew forth his notebook and pencil and handed them to
Drorathusa, pronouncing as she took them that mysterious name:
"Lepraylya?"
A few strokes with the pencil, and Drorathusa had given us the
answer.
"You see, Bill?" said Rhodes, smiling. "A woman. In all likelihood,
too, the queen."
Drorathusa's Sibylline look was upon him once more—and she did
not smile.
Chapter 33
FACE TO FACE
We found the wall even more broken and difficult than it had
appeared from the entrance. It was almost destitute of vegetation, a
circumstance that contributed not a little to the slowness of the
descent. Indeed, making our way down over those pitching naked
rocks was a ticklish, an unpleasant business, I want to tell you; at
times it was really precarious.
We had halted to rest above one of these difficult spots, and every
one was either seated or leaning against the rock, when of a sudden
Milton, who was nearest the edge, arose and pointed, pointed down
and off to the right.
"Hello!" said he. "What's that?"
All of us arose, moved over and looked.
"Where?" I asked.
"Down there by that strange clump of cycadaceous trees, that clump
near those tall trees that look so much like Douglas firs. But 'tis gone
now."
"What did you see?"
"I haven't the faintest idea, Bill. But there certainly was something
there, and it was moving. And, if I were imaginative, I would probably
say that it was watching us, that, at the moment I arose and pointed,
it glided back to the concealment of the trees."
"Well, did it?"
"It certainly seemed to do so, Bill."
I peered down there again, but I could not see anything moving.
There was silence for some moments. The Dromans stood watching,
waiting; stood expectant, puzzled.
"Oh, well," Rhodes said, turning a quizzical look in my direction and
then to the face of Drorathusa, "we must expect to find live things in
that forest."
I saw Drorathusa's eyes fixed upon his face, then, a few moments
after he ceased speaking, return to the clump of cycads.
"Live things?" said I. "There may be things in this place of mystery
more terrible than any live thing."
"Come, Bill, come. It can't be so bad as you imagine it, or our
Dromans wouldn't be here.
"I wish," he added, "I knew what that thing is that I saw."
"Hello!" I cried the next moment, my look raised up to the vaulted
roof. "What does that mean? Good Heaven, what next?"
The light, which was brightest up along the roof—in fact, it seemed
pressed up against the rock-canopy like glowing, diaphanous mist—
was changing, fading. The wonderful opalescence of it was
disappearing before our eyes.
Of a sudden the spot where we stood was involved in a gloom
indescribably strange. Up above, the light-mist was quivering and
flickering, pale and dreadful.
"What in the world is it?" I cried.
"Queer place, this!" said Milton Rhodes.
"What can it mean?" I asked.
He did not answer. He sent a questioning look toward Drorathusa
and her companions. Mine followed. The faces of the Dromans
seemed to glimmer ghostlike in the thickening, awful darkness. Upon
those pale features, however, was no discoverable sign of alarm, of
uneasiness even.
The gloom deepened about us. Pitchy darkness came down with a
rush. Far away, and up along the roof, there were pale flickerings
and flashes. Then the light burst out, so sudden and so strong that
pain shot through the eyes.
Came a cry, and I turned to see Drorathusa pointing, pointing down
toward those cycads.
"There it is, Bill!" exclaimed Milton. "There it is again! See it
moving?"
I saw it, but it was for a fleeting moment only. And, I thought, I saw
something else.
"A little nearer this time," Rhodes told me. "There can be no doubt
that it is watching us."
"Evidently," I said, "it is moving over to lie in wait for us. And, unless
I'm very much deceived, it isn't alone."
"Hum," said Rhodes. "Queer place, Bill, to go into. Even our
Hypogeans, it seems, don't know what to make of that apparition."
They were conversing in low tones, casting searching, apprehensive
looks along the ragged margin of the forest.
The gloom was falling again. Denser and denser it grew about us.
Fainter, more and more dreadful became those distant flickerings
and flashes along the great vaulted roof. Darkness, blackness was
involving everything. Dimmer still became the flickerings. The
stillness was utter, portentous. There was not the gentlest movement
of air. The light gave a last faint, angry gleam and went out
altogether.
Abruptly, from out of the darkness, a voice came sounding, and,
though I knew that the voice was Drorathusa's, I started and almost
gave a cry. I pressed the button, and the rays of the lamp flashed
out, lighting up the spot and showing the tall figure of Drorathusa
with arms extended upward in some mystic invocation. The others
were kneeling, and the words that Drorathusa spoke were echoed,
as it were, in their low responsive voices. It was a strange scene,
truly—the dark, savage masses of rock, the tall Sibylline figure of the
woman, the kneeling forms of the others and we two men from the
sunlit world looking on in wonder and in awe.
Minutes passed. The wondrous, eerie voice of Drorathusa never
ceased, though there were moments when those echoing voices
were silent.
Look! Far away, there was a faint, ghostly flicker. Another and
another. Brighter they became and brighter still, at last opalescent;
soon rocks and forest, soon the whole weird landscape was again
bathed in the mystic pearly light.
"What, in the name of wonder," I said, "was it?"
"An eclipse," smiled Rhodes. "Queer place, this."
"Queer place? Can't you hit another tune? You don't have to keep
telling me that this is a queer place. I am not at all likely to forget that
fact. And I wonder if these 'eclipses' are a frequent phenomenon.
Certainly I hope that they are not."
"I wish that I could tell you, Bill, tell you that and a few other things."
"And," I added, "that forest, when the light goes, must be a queer
place truly—gosh, I'm catching it from you! But I'll tell you what: I
wouldn't like to find myself, in the depths of those woods, face to
face with a loopmuke or a gogrugron or something and in that instant
have the darkness come down."
"It would be rather unpleasant, I fancy. But unfortunately our likes or
our dislikes are not likely to alter in any way the scheme of things."
The Dromans, all standing now, were singing a low and sweet song
of thanksgiving and gladness. Yes, so sweet were the tones that
they seemed to linger in the air, for some moments, even after the
song had ceased.
We cast our looks along the margin of the forest, but not a single
glimpse was caught of that mysterious object, or objects, that we had
seen moving down there.
It was patent that the Dromans knew no more what to make of that
apparition than we did ourselves and that they looked forward with
no little apprehension to our entry into that wood.
The descent was resumed. Were eyes, somewhere below, watching
our every movement? I feared that it was indeed so, and, as I well
knew, every other member of our little band feared it, too. There was
nothing, however, that we could do except descend and face the
issue. To turn aside would be futile, for the watcher, or the watchers,
would turn aside also to meet us.
Ere long we reached the talus, and our troubles were then over; that
is, as regards the descent. But Heaven only knew what troubles
were awaiting us somewhere in that forest, to which we were now
drawing so very near.
As we made our way down over the rock-fragments, amidst which
shrubs and stunted trees were growing, more than once did we
pause and send keen, searching looks and glances into the silent
recess of that mysterious wood.
Some of those sylvan depths were enshadowed, gloomy; others
were pervaded with the strong, transparent light-mist, the objects
involved in which cast no shadows.
At the foot of the talus, almost beneath the branches of great palm-
trees, there was a pause.
"Now for it!" said Milton Rhodes solemnly.
The Dromans were clustered together in earnest but laconic
dialogue, their eyes employed the while in a keen scrutiny of the
forest aisles and recesses, before us and on either hand.
Insects were in the air about us; one or two shadowy butterflies
flitted past; and that was all. Not a leaf stirred; the air was without the
slightest movement. No song, no call of a bird broke the silence,
which seemed to press down upon us and about us as though it
were a tangible thing. It was as if the spot, the forest itself had never
known either the voice or the movement of any sentient thing. But,
somewhere in that forest, hidden and close at hand, there was
something sentient—something, in all likelihood, watching us,
watching and waiting. Waiting for what?
Or, came the sudden thought, even now stealing toward the place
where we stood.
"This suspense," said I to myself, "is simply awful, is as terrible,
even, as that which we knew when we were crossing the bridge, that
chasm of unknown depth on either side."
Drorathusa turned to us and pointed in a rather vague direction out
into the trees.
"Narranawnzee," she said.
"Evidently," said Milton, "they plan to strike that stream."
"I pray Heaven," I told him, "that we live to see that narranawnzee."
Whereupon Rhodes laughed outright, and the effect of the sudden
sound was curious and startling, so great was the tension of our
nerves.
"One would think, Gloomy Face," said he, "that you had just issued
from the Cave of Trophonius. 'And he never smiled again.'"
"I have an idea, grinning Shaky Knees," I retorted, "that we have got
ourselves into a place more awful than any Cave of Trophonius. I
don't blink, that's all."
"Nor, Bill, do I," said Milton soberly. "You know, I'd feel more at ease
if it wasn't for the presence of the ladies. Why did they come on a
journey so hazardous and so terrible?"
How often had we wondered that! We didn't know the ladies of
Drome.
We at once got in motion. Ondonarkus and Rhodes were leading,
Drorathusa was just behind them, then came Nandradelphis and
Silvisiris, whilst Zenvothunbro and myself brought up the rear. This
disposition of our little party was as Drorathusa herself had desired
it, and she had been at some pains to impress upon Rhodes and me
(though there had been no necessity for that) the expediency of
keeping our weapons ready for action at any instant.
On we went, deeper and deeper into the wood. Strange forms of
vegetation, strange flowers, strange insects were everywhere. How
interesting we should have found the place! But there was that thing,
somewhere hidden, watching us perhaps—following.
Came a sharp exclamation, a dull sound from above; but it was only
a bird, a thing of silver and gold, launching itself from off a branch of
one of the trees which we were approaching. Away it went sailing,
lovely as a vision from fairyland, and disappeared amongst the tree-
trunks and foliage.
Five minutes or so passed. Another sound, an exclamation from
Drorathusa, and the party came to a sudden halt.
Every one had heard it—a clear, unmistakable but inexplicable
sound and from behind. We were being followed!
We stood listening for some moments, waiting; but the sound did not
come again. Save for the low melancholy drone of insects, the spot
was as silent as a tomb.
We resumed our advance, every sense on the alert. A few moments
passed, and then we heard it again. This time it was off to the right,
almost abreast of us, it seemed.
Had it thus quickened its movements in order to get in front of us?
We waited, but nothing was seen, nothing was heard.
We had advanced but twenty or thirty feet when a sudden gloom
involved the forest. The scene on the instant turned weird, unearthly.
This, however, was but a few moments only; then came the light.
The advance was at once resumed. But we had gone only a short
distance when the gloom came once more, grew so dense that we
had to come to a halt.
It lifted, just as I was on the point of switching on my electric light.
Then like a bolt came utter darkness. And, even as the darkness fell,
there was a velvety sound and a faint rustling from amongst the
foliage beside us. With frantic haste I sought and pressed the light-
switch. At the same instant Rhodes flashed on his light. A cry of
horror broke from me. There, thrust over the top of a great log and
but a few yards distant, was a long snaky head with a pair of great
blazing eyes fixed upon me.
We were face to face at last!
Chapter 34
ANOTHER!
I jerked out my revolver, took swift aim, right between those great
blazing eyes, and fired.
From the beast came a fearful roar, which seemed to end in a
scream, and the long snaky head and neck (no more of the animal
had been visible) disappeared.
"Good work, Bill!" applauded Milton Rhodes.
He had hardly spoken when the light came again, strong and
beautiful. And the next instant came something else. A dark form,
with a gleam of something white, rose into the air and drove straight
toward us. I sprang aside and turned to fire, but I did not do so for
fear of hitting the Dromans or Rhodes. There came a piercing shriek
from Drorathusa, a sound made by cloth-rending talons. The
monster had her.
"How like the big face of a fat man!"

I leaped toward it and emptied the revolver into its side, whilst
Ondonarkus and Zenvothunbro sent each an arrow into the body.
That of the former was driven with such force that it passed clear
through the body and went on for a distance of six or eight feet. And
down the beast fell dead, though still quivering, there in our very
midst.
I turned and hurried to Drorathusa. Rhodes was already beside her.
As I reached her, the darkness came down again upon the place,
pitchy and awful. The claws had ripped her dress, from the thigh

You might also like