Using TextMate as the Default Editor for Git on OS X
Posted At : June 3, 2010 9:23 AM | Posted By : Bob Silverberg
Related Categories: Git, OS X
There are a number of Git commands which pop open a text editor which you then use to provide information. For example, if you issue the command:
The editor will appear allowing you to type your commit message. The default editor that appears for me, on OS X, is vi which is a strange beast to work with if you've never encountered it before (which I hadn't, prior to using Git). I found a helpful cheat sheet, which allowed me to use the editor, but I still find it cumbersome. Thankfully it's a pretty simple matter to use a different text editor with Git. There are a number of ways of doing this, and I'm going to discuss two of them. To start, let's look at how Git decides what editor to use.
Which editor will Git use?
According to the man page for git-commit:
The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order).
We're going to look at changing the EDITOR environment variable and the core.editor configuration variable.
Change the EDITOR environment variable
Simply add the following line to your .bash_profile:
This will cause Git to use TextMate, and may also allow other command line tools to use it as well.
Change the core.editor configuration variable
Issue the following command:
This is useful if you only want to change the behaviour of Git, and not affect the rest of your environment.
There are no comments for this entry.
[Add Comment] [Subscribe to Comments]