Last Updated: February 25, 2016
·
2.121K
· tserong

`git diff -b` (actually legible when reindenting code)

Contrast git diff output:

diff --git a/indent.rb b/indent.rb
index 81595d9..08ec43c 100644
--- a/indent.rb
+++ b/indent.rb
@@ -1,7 +1,9 @@
-def fn
-  # big complicated
-  # function body
-  # ...
-  # ...
+def fn(really_do_it)
+  if really_do_it
+    # big complicated
+    # function body
+    # ...
+    # ...
+  end
 end

With git diff -b output:

diff --git a/indent.rb b/indent.rb
index 81595d9..08ec43c 100644
--- a/indent.rb
+++ b/indent.rb
@@ -1,7 +1,9 @@
-def fn
+def fn(really_do_it)
+  if really_do_it
     # big complicated
     # function body
     # ...
     # ...
+  end
 end

(I still don't know how I only found out about this just now...)

2 Responses
Add your response

Coolest thing I learned today!

over 1 year ago ·

Much better option is: -w

over 1 year ago ·