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

Published: 09 September 2021
on channel: 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.


Watch video 1 minute coding tip: git diff-words to see diffs on a per-word basis instead of per line online without registration, duration hours minute second in high quality. This video was added by user Studying With Alex 09 September 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 4,095 once and liked it 262 people.