Skip to content

Commit 1f5daf9

Browse files
authored
Update diff.md (jaywcjlove#379)
1 parent db4c9ab commit 1f5daf9

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

command/diff.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,62 @@ diff(选项)(参数)
5959

6060
### 实例
6161

62+
#### 以正常模式比较差异
63+
64+
```shell
65+
diff a.txt b.txt
66+
```
67+
68+
#### 以上下文 (context) 模式比较差异
69+
70+
```shell
71+
diff -c a.txt b.txt
72+
```
73+
74+
```
75+
  *** a1.txt 2012-08-29 16:45:41.000000000 +0800
76+
  --- a2.txt 2012-08-29 16:45:51.000000000 +0800
77+
  ***************
78+
  *** 1,7 ****
79+
   a
80+
   a
81+
   a
82+
  !a
83+
   a
84+
   a
85+
   a
86+
  --- 1,7 ----
87+
   a
88+
   a
89+
   a
90+
  !b
91+
   a
92+
   a
93+
   a
94+
```
95+
96+
#### 以联合 (unified) 模式比较差异
97+
98+
```shell
99+
diff -u a.txt b.txt
100+
```
101+
102+
```
103+
  --- a.txt 2012-08-29 16:45:41.000000000 +0800
104+
  +++ b.txt 2012-08-29 16:45:51.000000000 +0800
105+
  @@ -1,7 +1,7 @@
106+
   a
107+
   a
108+
   a
109+
  -a
110+
  +b
111+
   a
112+
   a
113+
   a
114+
```
115+
116+
#### 多文件比较差异
117+
62118
将目录`/usr/li`下的文件"test.txt"与当前目录下的文件"test.txt"进行比较,输入如下命令:
63119

64120
```shell

0 commit comments

Comments
 (0)