When I run git diff to see what was changed in a modified file, diff displays many highlighted escape sequences. For example:
ESC[1mindex a7671ab..c228e2c 100644ESC[m
ESC[1m--- a/core/bp-nav-horizontal.phpESC[m
ESC[1m+++ b/core/bp-nav-horizontal.phpESC[m
ESC[36m@@ -77,7 +77,7 @@ESC[m
<!-- Contact Us -->ESC[m
<ul>ESC[m
<li>ESC[m
How can I suppress these ESC[xxx
characters. They make it very hard to read the text.
Amended 15 Aug 2014
This is not really about git diff. Displays of git log also show the ESC...
characters. This seems like a configuration problem, but I don't know where it is. Where should I look?
Python escape sequence ignore To ignore all the escape sequences in the string, we have to make a string as a raw string using 'r' before the string. After that escape sequence will also be considered normal characters.
The correct option is col1\tcol2\tcol3\tOpen() for execution.
The problem is with the pager used by GIT to print diffs and logs. Adding -R to the configuration for less solved the problem for me. I used
git config --global core.pager "less -R"
You might have set color.ui=always (or auto
and the terminal detection does not work). You can turn it off with never
(if it is always
try auto
first).
You can configure all commands with config.ui
or specific for git-diff with color.diff
.
git config --global color.ui never
Use
git config --local -l
git config --global -l
git config --system -l
To list the current settings for the project, user and machine. To switch it temporarily on/off you can use the --color=always
argument at each command. For example:
git log --color=never
See also: http://git-scm.com/book/en/Customizing-Git-Git-Configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With