Raivo Laanemets. Software consultant.

Fix git diff on Slackware

On

The git diff command shows garbage output on the Slackware 14.1 installation. Here is a small tip that fixes it.

The default output from git diff is not very readable:

ESC[1mdiff --git a/Makefile b/MakefileESC[m
ESC[1mindex e0d98eb..dd2a4ef 100644ESC[m
ESC[1m--- a/MakefileESC[m
ESC[1m+++ b/MakefileESC[m
ESC[36m@@ -23,7 +23,4 @@ESC[m ESC[mcheck:ESC[m
 clean:ESC[m
        $(MAKE) -C admin cleanESC[m
 ESC[m
ESC[31m-test-admin:ESC[m
ESC[31m-        $(MAKE) -C admin testESC[m
ESC[31m-ESC[m
 .PHONY: test package upload admin clean check install-tools test-adminESC[m

To fix the output, the ~/.bashrc file needs an entry:

unset LESS

The fix is related to Why does diff/log not show color, even though I enabled it? as less with existing arguments in $LESS will ignore those set by the git command.

After adding the entry and opening a new Konsole window, the output will be readable:

diff --git a/Makefile b/Makefile
index e0d98eb..dd2a4ef 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,4 @@ check:
 clean:
        $(MAKE) -C admin clean

-test-admin:
-       $(MAKE) -C admin test
-
 .PHONY: test package upload admin clean check install-tools test-admin

Comments

No comments have been added so far.

Email is not displayed anywhere.
URLs (max 3) starting with http:// or https:// can be used. Use @Name to mention someone.