git-learner/notes/2.8-git-gui.md
2024-08-19 10:49:44 +02:00

46 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## git UI
### 2.8.4 git rev-parse
```bash
git rev-parse --symbolic --branches # 显示分支
git rev-parse --symbolic --tags # 显示里程碑
git rev-parse --symbolic --glob=refs/* # 显示所有的引用
```
`git rev-parse`可以将一个Git对象表达式表示为对应的SHA1哈希值
tag也分为两种lightweighted tag和annotated tag
```bash
git tag <tagname> # lighteweighted tag
git tag -a <tagname> -m <message> # annotated tag
```
两种的区别在于轻量标签只会有commit对象
标记标签会自己生成一个对象然后指向commit对象
所以下面的内容中,`git rev-parse`指令的参数A和A^0是不同的哈希
```bash
git rev-parse master refs/heads/master # 显示多个哈希
git rev-parse A refs/tags/A
git rev-parse A^{} A^0 A^{commit}
git rev-parse A^3 # ~<n> = <n> ^
```
### 2.8.4.2 git rev-list
git rev-list 用来帮助研究Git的各种**版本范围语法**。
```bash
git rev-list --oneline A
git rev-list --oneline D F # 使用两个tag的并集
git rev-list --oneline ^G D # 排除这个版本和历史版本 等价于
git rev-list --oneline G..D # 连接两个版本
git rev-list --oneline B...C # 两个版本共同能够访问的除外
git rev-list --oneline B^@ # 提交的历史提交,自身除外
git rev-list --oneline B^! # 只看提交本身
```
### 2.8.4.3 git log