Avoiding Escape Characters When Using Git

Since I had this problem on my FreeBSD system I figured it would be useful to document it here for myself for future reference so I won’t forget and just in case someone else stumbles across it.   If you are having a problem with seeing escape characters as shown below whenever you invoke “git log” or “git diff” there is a simple solution.

ESC[33mcommit398e78c62fd507a317de7c2abb8e29eESC[m

The simple fix is to change the git core.pager variable and set it either to “more” or “less -r”.  I chose the “less -r” approach and it corrected my problem with seeing escape sequences.

Leave a comment

Your email address will not be published. Required fields are marked *