章节 ▾
第二版
-
1. 起步
-
2. Git 基础
-
3. Git 分支
-
4. 服务器上的 Git
- 4.1 协议
- 4.2 在服务器上部署 Git
- 4.3 生成 SSH 公钥
- 4.4 架设服务器
- 4.5 Git Daemon
- 4.6 Smart HTTP
- 4.7 GitWeb
- 4.8 GitLab
- 4.9 第三方托管服务
- 4.10 小结
-
5. 分布式 Git
-
A1. 附录 A: Git 在其他环境
- A1.1 图形界面
- A1.2 Visual Studio 中的 Git
- A1.3 Visual Studio Code 中的 Git
- A1.4 IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine 中的 Git
- A1.5 Sublime Text 中的 Git
- A1.6 Bash 中的 Git
- A1.7 Zsh 中的 Git
- A1.8 PowerShell 中的 Git
- A1.9 小结
-
A2. 附录 B: 在应用程序中嵌入 Git
-
A3. 附录 C: Git 命令
A3.6 附录 C:Git 命令 - 检查与比较
检查和比较
git show
git show 命令可以以一种简单易读的方式展示 Git 对象。通常你用它来展示标签或提交的信息。
我们首先在Annotated Tags中用它来展示带附注的标签信息。
之后我们会在Revision Selection中频繁使用它,以展示我们各种版本选择所解析到的提交。
我们对 git show 最有趣的使用之一是在Manual File Re-merging中,用于在合并冲突期间提取不同阶段的特定文件内容。
git shortlog
git shortlog 命令用于总结 git log 的输出。它会接受与 git log 命令相同的许多选项,但它不是列出所有提交,而是按作者分组展示提交摘要。
我们在The Shortlog中展示了如何用它来创建一个漂亮的变更日志。
git describe
git describe 命令用于获取任何解析为提交的内容,并生成一个相对易读且不会改变的字符串。这是一种获取提交描述的方法,它像提交 SHA-1 一样明确,但更容易理解。
我们在Generating a Build Number和Preparing a Release中使用 git describe 来获取一个字符串,用作我们发布文件的名称。