-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdiff
33 lines (23 loc) · 848 Bytes
/
diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# To view the differences between two files:
diff -u <file-1> <file-2>
# To view the differences between two directories:
diff -ur <dir-1> <dir-2>
# To ignore whitespace:
diff -ub <file-1> <file-2>
# To ignore blank lines:
diff -uB <file-1> <file-2>
# To ignore the differences between uppercase and lowercase:
diff -ui <file-1> <file-2>
# To report whether the files differ:
diff -q <file-1> <file-2>
# To report whether the files are identical:
diff -s <file-1> <file-2>
# To diff the output of two commands or scripts:
diff <(command1) <(command2)
# To generate a patch file from two files:
diff -Naur <file-1> <file-2> > $patch_file
# use git diff to generate patch file
git diff $commit_old $commit_new > $patch_file
# generate git patch file (included commit info)
git format-patch -o patch origin/develop..develop
# vim: set ft=sh