git - started complaining about whitespace?

Erik Garrison erik at laptop.org
Mon Jul 14 12:15:02 EDT 2008


On Mon, Jul 14, 2008 at 05:27:05PM +0530, Tarun Pondicherry wrote:
> Hi,
> 
> Recently, I tried to commit some changes and I got several messages 
> about trailing whitespace.  I tried to redownload that same library 
> (Zend GData) again and check it in, but had the same issues.  There was 
> no problem with that library when I first put it in a few weeks ago.  I 
> tried looking online, but the git-config fixes did not work for me.  The 
> files are Unix formatted so it is not the CR bug.  I'm very new to git.  
> Is there a way to make git ignore this issue?

Tarun,

You can at least observe where the trailing whitespace occurs by adding
the following stanzas to your ~/.gitconfig:

    [color]
      diff = auto
      log = auto
      commit = auto

    [alias]
      diff = diff --color-words

Now any git-diff output on the terminal (including git log -p) will show
you trailing whitespace as red blocks.  I'm not typically one to worry
about such things, but the red blocks have made it pretty trivial to
eliminate the trailing characters from my patches.

Erik



More information about the Devel mailing list