git diff showing a weird output ^[[1;33m^[[mmmmh?!

I came back to an old project on another machine only to find that the git diff command did not behave as expected anymore:

^[[1;33mdiff --git a/myproject/myapp/models.py b/myproject/myapp/models.py^[[m
^[[1;33mindex 0216829..d9e1637 100644^[[m
^[[1;33m--- a/myproject/myapp/models.py^[[m
^[[1;33m+++ b/myproject/myapp/models.py^[[m
^[[1;35m@@ -87,6 +87,12 @@^[[m ^[[mclass DoomDoomDoom(models.Model):^[[m

Instead of showing the colours defined in ~/.gitconfig, it was displaying escaped sequences in black and white, as well as a "(stdin)" prompt at the bottom of the page.

At first I thought it was a difftool issue but actually it relates to the pager, i.e. with either of these commands things works well:

$ git --no-pager diff # No paging
$ git diff --color | less -R # With paging

The default pager in git is supposed to be 'less'... Still, making sure it actually is fixed this for me:

$ git config --global core.pager 'less'

I'm still annoyed. Why was a different pager being used (and not showing in git config --list) and what tool was it?


< Back to main >

PAGER environment variable seems to be what is used (this got me too) #1. Posted by prc on Thu 03 Oct 2013, 15:10

Great, thanks for the tip! PAGER doesn't appear to be defined on my system though, this is so curious. #2. Posted by jpichon (Website) on Thu 03 Oct 2013, 20:19

Hello! This text is normally hidden with CSS. If you can see this, you'll also see two additional fields with no label on the form. Leave them as is, as those are aimed at catching form-filling spam bots. Thank you!

    Name: (or OpenID Sign in with OpenID)
      Email: (Not published)
        Website:
          Comment:
           

          < Back to main | Up >