Menelaos
Menelaos

Reputation: 26549

git diff - ignore all linefeeds between revisions

A team member used automated source formatting in eclipse and commited the code with the source code formatting. I want a way to see only what they changed in code... not the muckup of everything.

I'm running the following command:

$ git diff -b -w comit1234 commit5678

I still get the following:

-       private final ArrayList<Application> preparedApps = new
-                       ArrayList<Application>(100);
-       private final ArrayList<Application> sponsoredApps = new
-                       ArrayList<Application>(100);
-       private final ArrayList<Application> nonSponsoredApps = new
-                       ArrayList<Application>(100);
+       private final ArrayList<Application> preparedApps = new ArrayList<Applic
+                       100);
+       private final ArrayList<Application> sponsoredApps = new ArrayList<Appli
+                       100);
+       private final ArrayList<Application> nonSponsoredApps = new ArrayList<Ap
+                       100);

Is there a command to ignore changes like this?

Upvotes: 2

Views: 131

Answers (1)

VonC
VonC

Reputation: 1328982

The problem is in how the lines are wrapped.

If those lines are on several lines, git diff will always detect those as different before/after reformat, because the diff is done line by line, as mentioned in "How do I get git-blame and log to ignore line wrap changes?".

Upvotes: 1

Related Questions