简体   繁体   中英

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?

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? ".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM