2018-06-10 Git diff in Eshell

I try to use Eshell more, as part of a general drive towards moving everything into Emacs. One thing that annoyed me a bit was issuing a git diff or something similar in Eshell. Invariably, I received a WARNING: terminal is not fully functional.

I am not sure, but I suspect that the reason is that Eshell does not really like less, which seems to be the default Git pager.

Now there exist quite a lot of ways to overcome this issue. One is having

(setenv "PAGER" "cat")

in your init.el. This is, however, an all-or-nothing type solution, since it affects all programs started from Emacs. (Though maybe this is the right way?) I have discovered another, truly remarkable solution of this problem which this blog post is too short to contain;-), and hence it must wait for another time.

Problem solved – at least partially. The diff is not colored at all! Again, this is easy to overcome: just put

[color]
	ui = always

in your .git/config and you’re done.

(Please let me know if this has any undesirable side-effects.)

Of course, I don’t use git diff in Eshell very often, since there is Magit – but sometimes I want to e.g. show someone what it looks like to use Git, and then I start with the command line.

CategoryEnglish, CategoryBlog, CategoryEmacs, CategoryEshell, CategoryGit