mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(diff): get better diffs in the terminal
This commit is contained in:
@@ -112,6 +112,7 @@ git log -p 'feature' --not 'master'
|
||||
|
||||
# Just show changes between two files.
|
||||
git diff --no-index 'path/to/file/a' 'path/to/file/b'
|
||||
git diff --no-index --word-diff --patience 'path/to/file/A' 'path/to/file/B'
|
||||
|
||||
# Stage changes for commit.
|
||||
git add .
|
||||
@@ -584,6 +585,7 @@ git diff --word-diff='porcelain'
|
||||
# DO NOT consider them part of of the repository.
|
||||
# This can be used to diff any two files.
|
||||
git diff --no-index 'path/to/file/A' 'path/to/file/B'
|
||||
git diff --no-index --word-diff --patience 'path/to/file/A' 'path/to/file/B'
|
||||
```
|
||||
|
||||
Better word-aware diff:
|
||||
|
||||
12
snippets/diff.sh
Normal file
12
snippets/diff.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
#!sh
|
||||
|
||||
# Sources:
|
||||
# - https://stackoverflow.com/questions/8800578/how-to-colorize-diff-on-the-command-line
|
||||
|
||||
git diff --no-index 'file1' 'file2'
|
||||
git diff --no-index --word-diff --patience 'file1' 'file2'
|
||||
|
||||
vimdiff 'file1' 'file2'
|
||||
|
||||
diff 'file1' 'file2'
|
||||
diff -y -W 'width' 'file1' 'file2'
|
||||
4
snippets/view.sh
Normal file
4
snippets/view.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!sh
|
||||
|
||||
# Just `vim` but read-only.
|
||||
view 'file'
|
||||
Reference in New Issue
Block a user