Source control for documents - Git Word Diff
For all of you who check your <favorite markup language here> files into Git source control, you might want to know about word diffs:
git diff --word-diff
This will highlight the individual words changed in a line, and not the entire line, which is really useful if, for example, you write your paragraphs in a single line. This however still uses less
(or whatever pager you have configured), so the lines will probably not wrap around in the terminal. Therefore I always disable the pager entirely when using word-diff:
GIT_PAGER='' git diff --word-diff
Or in short, as an alias in your .bash_profile
:
alias gwd="GIT_PAGER='' git diff --word-diff"
Written by Lucas
Related protips
1 Response
Nice option, thanks for sharing. Note that you can disable the pager using the --no-pager option: $ git --no-pager diff --word-diff
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Markup
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#