12 August 2014

Here is a quick tip about git. It is useful when you edit a very long line and you want to see the actual changes in that commit within that single line. “word-diff” is an option that we can use in such cases.

To do that, use:

GIT_PAGER='' git diff commit1..commit2 --word-diff

where commit1 and commit2 are boundaries of your changes. GIT_PAGER setting provides words wrap, so your line is not cut at the console screen border.

The example output for a very long hash definition line is as shown below :

git-pager