Compare commits
9 Commits
15c0ebbff6
...
C
Author | SHA1 | Date | |
---|---|---|---|
572f5215ce | |||
9d867fc271 | |||
515dd2b9c4 | |||
7fca44eac8 | |||
ce2b85da59 | |||
df3218e422 | |||
73624ddf35 | |||
a4039843d6 | |||
7952818907 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.h
|
*.h
|
||||||
hello
|
hello
|
||||||
|
*.pyc
|
||||||
|
@@ -33,6 +33,7 @@ git rev-parse A^3 # ~<n> = <n> ^
|
|||||||
`git rm`会执行两个指令:
|
`git rm`会执行两个指令:
|
||||||
1. 删除文件(工作区中的)
|
1. 删除文件(工作区中的)
|
||||||
2. 添加删除操作到暂存区
|
2. 添加删除操作到暂存区
|
||||||
|
3. 有一个前提是文件必须已经被git所跟踪
|
||||||
|
|
||||||
`git add -u`是将工作区的已经被git跟踪的文件添加到暂存区,包括修改和删除
|
`git add -u`是将工作区的已经被git跟踪的文件添加到暂存区,包括修改和删除
|
||||||
|
|
||||||
@@ -53,3 +54,99 @@ git rev-list --oneline B^! # 只看提交本身
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2.8.4.3 git log
|
### 2.8.4.3 git log
|
||||||
|
|
||||||
|
显示提交历史
|
||||||
|
|
||||||
|
参数代表版本范围
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git log --oneline F^! D
|
||||||
|
```
|
||||||
|
**graph show**
|
||||||
|
```bash
|
||||||
|
git config alias.glog "log --graph"# 用别名
|
||||||
|
git glog --oneline
|
||||||
|
```
|
||||||
|
|
||||||
|
显示最近几条
|
||||||
|
```bash
|
||||||
|
git log -3 --pretty=oneline
|
||||||
|
```
|
||||||
|
|
||||||
|
显示提交的具体改动
|
||||||
|
```bash
|
||||||
|
git log -p -1
|
||||||
|
```
|
||||||
|
|
||||||
|
显示变更概要
|
||||||
|
```bash
|
||||||
|
git log --stat --oneline I..C #显示版本I到C的变更概要
|
||||||
|
```
|
||||||
|
|
||||||
|
显示参数
|
||||||
|
```bash
|
||||||
|
git log --pretty=raw -1 # 显示提交的原始数据,
|
||||||
|
git log --pretty=fuller -1 # 显示作者和提交者
|
||||||
|
git log --pretty=oneline # 提供最精简的日志输出
|
||||||
|
```
|
||||||
|
|
||||||
|
只是查看,分析某一次的提交,可以使用`git show`或者是`git cat-file`命令
|
||||||
|
```bash
|
||||||
|
git show D --stat # 展示里程碑D及其提交
|
||||||
|
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恢复进度
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
welcome.txt
Normal file
1
welcome.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Hello world
|
Reference in New Issue
Block a user