1
0
forked from iicd/git-learner

add git bisect part

This commit is contained in:
Mhrooz 2024-08-19 15:16:53 +02:00
parent 7952818907
commit a8029669af

View File

@ -98,3 +98,55 @@ git cat-file -p D^0 # 展示里程碑D及其提交
### 2.8.4.4 git diff
```bash
git diff B A # 比较B和A里程碑
git diff A # 比较工作区和里程碑A
git diff --cached A
git diff
git diff --cached
git diff HEAD
```
```bash
git diff --word-diff
```
### 2.8.4.5 git blame
可以追溯指出是谁在什么时候,什么版本引入的代码
```
git blame <filename>
git blame -L <n,m> <filename> # 查看某几行
```
### 2.8.4.6 git bisect
用于二分查找什么时候引入的代码
```bash
git bisect start # 开始二分查找
git bisect bad # 设置当前版本为坏版本
git bisect good G # 设置里程碑G为好版本
git bisect reset # 结束
```
标记错误,恢复
```bash
git bisect log > logfile # 打开logfile删除标记错误的行
git bisect reset
git bisect replay logfile # 用logfile恢复进度
```