1 minute coding tip: git diff-words to see diffs on a per-word basis instead of per line

Опубликовано: 09 Сентябрь 2021
на канале: Studying With Alex
4,095
262

1. Open ~/.gitconfig in your favorite editor.
2. Find the [alias] section. If it doesn't exist, add "[alias]" this to the bottom of your .gitconfig.
3. Under the alias section, add this text:

diff-words = diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'

Final result:

[alias]
diff-words = diff --color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD)+'

4. Run git diff-words.