Git diff by word?

By default, git diff shows differences by lines. In terminal, we can use git diff --color-word to show differences by words. This can be quite useful when we write in Rmarkdown. Because, at least for me, I write the whole paragraph in one line. If I change something of this paragraph, in the Git panel of RStudio, it will show the whole line without highlighting the words.

Is it possible to add an option to highlight words when look at diff in the Git panel? Or any other way to do this without typing the command in terminal?

Thanks.

4 Likes

I don't definitively know if it's possible, but I think part of the motivation for integrating the terminal into RStudio was because of the many, many features git offers that are (obviously) not part of the limited RStudio Git GUI. @jonathan mentions this in the beginning of the recent IDE webinar (~4mins in):
https://www.rstudio.com/resources/webinars/new-features-of-the-ide/

Dropping into the RStudio terminal is alt+shift+T.

1 Like