From: Jason Sewall <hidden> Date: 2016-06-15 22:43:17
I'm pretty new to git, but I've been using it a lot recently and I'm
really liking it.
I do have a question that I'm 99% sure is a stupid one but I'd like an
answer anyway.
I recently make a few simple changes to a working directory, and
decided to do a diff before I committed it.
The results were something like the diff at the end of this email.
It seems like every change listed after the first one is meaningless.
I really think I just don't understand something about the diff
algorithm. Can someone tell my why those empty lines are recorded as
changes?
Jason
P.S. git diff --check is empty; there's no whitespace on those lines
P.P.S. The diff:
It seems like every change listed after the first one is meaningless.
I really think I just don't understand something about the diff
algorithm. Can someone tell my why those empty lines are recorded as
changes?
This are whitespace changes.
$ git diff --color
marks whitespaces at the end of the line with a red background color
so you can see what changed. I also use vim with :set list to see
whitespace changes, e.g.
$ git diff | vim -c 'set list' -
If you like to have colors (not just in diff) permnanently you can add
this to your .git/config or ~/.gitconfig:
[color]
branch = auto
diff = auto
status = auto
pager = true
See also git-config(1) for more information on these and other
configuration options.
From: Jason Sewall <hidden> Date: 2016-06-15 22:43:17
As I mentioned in the ps, I git-diff --check shows nothing. As a
matter of fact, I do have color turned on and the pluses are green and
minuses red, but there are none of the characteristic red blocks that
trailing whitespace makes.
On 6/20/07, Matthias Lederhofer [off-list ref] wrote:
Jason Sewall [off-list ref] wrote:
quoted
It seems like every change listed after the first one is meaningless.
I really think I just don't understand something about the diff
algorithm. Can someone tell my why those empty lines are recorded as
changes?
This are whitespace changes.
$ git diff --color
marks whitespaces at the end of the line with a red background color
so you can see what changed. I also use vim with :set list to see
whitespace changes, e.g.
$ git diff | vim -c 'set list' -
If you like to have colors (not just in diff) permnanently you can add
this to your .git/config or ~/.gitconfig:
[color]
branch = auto
diff = auto
status = auto
pager = true
See also git-config(1) for more information on these and other
configuration options.
From: Jason Sewall <hidden> Date: 2016-06-15 22:43:17
Ok, it was my bad. There *were* whitespaces on those lines, but in
HEAD^, not head. Git only cares when they are introduced, not when
they are removed. So git diff HEAD^..HEAD showed that strange line
removal/add but git diff HEAD..HEAD^ shows me the whitespace.
I recently set up emacs to strip whitespace whenever I save a file to
prevent git from complaining (and it's good practice anyway), so that
explains why I didn't expect the change
Sorry about the mixup, and thanks for your help.
On 6/21/07, Johannes Schindelin [off-list ref] wrote:
Hi,
On Thu, 21 Jun 2007, Raimund Bauer wrote:
quoted
On Thu, 2007-06-21 at 02:13 +0100, Johannes Schindelin wrote: