Brian Moore
Brian Moore

Reputation: 1698

Git Diff Shows Reversed Colors/Indicators

I am looking at my git diff and the lines are exactly reversed. New lines show with "-"s and red colors, and the removed lines show with "+"s and green colors.

+ deleted line [green]
- newline [red]

Nothing in my .gitconfig seems to indicate anything amiss.

Anyone ever seen this happen before? What did you do to fix? Thanks!

Upvotes: 4

Views: 2491

Answers (3)

Matias
Matias

Reputation: 509

In git diff A B, A is the one in red and B is the one in green (as Eugene said, the order matters)

Upvotes: 6

Eugene Sajine
Eugene Sajine

Reputation: 8200

The direction of the diff is important: git diff A B will provide different output than git diff B A and the difference will be in reversing what was deleted and what was added.

Upvotes: 7

JB.
JB.

Reputation: 42094

You can instruct the inner diff to consider its inputs reversed using the -R option:

git diff -R

But this is a kludge. You'd better clarify what exactly you're diffing and instruct git to compare things in the order you actually expect.

Upvotes: 0

Related Questions