git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Highlighting whitespace on removal with git diff

From
SFStonky Fandango <stonkyfandango@gmail.com>
Date
Oct 20, 2010, 00:46 UTC
Message-ID
<AANLkTik7a8OQz2+SVTm+HjZkCtbjm6O9d12biCJ8MyZz@mail.gmail.com>

When I do say 'git diff', and I have added a line with a trailing whitespace, i get a red square box highlighting the added whitespace. (on the '+' diff line) What I want, is the reverse - so when I delete an existing whitespace, I get something similar, for example a blue box highlighting the deleted whitespace (on the '-' diff line)

Currently the only notificate I get is identical '-' and '+' diff lines, but no indication of the whitespace deleted

I know I can do this with graphical tools, but ideally would like some way using the standard console git diff - if this is possible.

I have  the following in my .gitconfig
---
[color "diff"]
whitespace = red reverse
[core]
 whitespace=-indent-with-non-tab,trailing-space,cr-at-eol,tab-in-indent
---
Thanks,
Next: Kevin Ballard
Message 1 of 3 in “Highlighting whitespace on removal with git diff”
  1. Stonky FandangoOct 20, 2010
  2. Kevin BallardOct 20, 2010
  3. Junio C HamanoOct 20, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.