Git Config

Smylers Smylers at stripey.com
Mon Aug 22 15:12:57 BST 2011


Aaron Crane writes:

> Jason Clifford <jason at ukfsn.org> wrote:
> 
> > On Sat, 2011-08-20 at 11:32 +0100, Smylers wrote:
> > 
> > > Hello. How can I make the git diff command use the -b flag (aka
> > > --ignore-space-change) by default?
> >
> > Have you tried: git config --global apply.whitespace nowarn
> 
> AIUI, that's the opposite — it's about dealing with whitespace when
> applying patches, not pretending that whitespace changes don't exist
> when generating diffs.

Yes, I don't want to change what git itself does with code, just what it
shows me when I run git diff to review a change before committing it. In
particular, I want that if I've wrapped a block around some code it
doesn't show lines where the only change is in its indentation, thereby
making it harder to spot actual changes.

> My suggestion would be to alias `git d` (or similar) to `git diff -b`,
> leaving plain `git diff` unmolested.  But I realise that isn't quite
> what you asked for, Smylers.

Good idea.

It seems I could also set git.external to a script which calls diff -b,
but I can't work out if that just gets used by git diff or would also be
invoked by any internal operation where git needs a diff for its own use
(which I probably don't want, and might mess things up).

Smylers


More information about the london.pm mailing list