18

I have my editor setup to be textmate but when I do a git diff it uses vi to show me the diff output, is there any way to set it to show the diff in textmate?

John Duff
  • 38,090
  • 5
  • 35
  • 45

4 Answers4

30

I normally pipe the contents to mate like this:

git diff | mate -
Bill Turner
  • 3,695
  • 1
  • 20
  • 26
  • 3
    Also, just as an interesting point: you don't need to specify the `-` when piping to `mate` because `mate` reads from stdin when run with no parameters. – rfunduk Oct 22 '09 at 22:03
  • 1
    For some reason when I look at (git) diff output saved as a file using TextMate, there's nice coloring. When I pipe the output of git to mate like this, the coloring is omitted. Not sure what's going on here. – Eric Walker Feb 02 '11 at 23:22
  • Yeah that has been bothering me too. TextMate doesn't always show it with the proper diff formatting. Seems to default back to last one it used. Maybe we should pipe it to a .diff file in /tmp and then mate that? – Brian Armstrong Jul 01 '12 at 21:46
8

The GIT_PAGER environment variable is used to specify which program to use to show multi-page output. You should be able to set this to point to textmate.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
  • 1
    Thanks, I was looking for this. Here's the git config equivalent: git config --global core.pager "/usr/bin/mate" – cobra libre Jun 09 '09 at 04:21
5

If you have the Terminal link installed it's simple:

git diff | mate

I personally have an alias setup that maps 'diffmate' to that command.

DarthNerdus
  • 1,340
  • 1
  • 13
  • 14
1

Also, it should be pointed out that, within TextMate, one can use Bundles>>Diff to perform the comparison within TextMate.

DanHickstein
  • 6,588
  • 13
  • 54
  • 90