Thoughts on the web, travel & remote working life by Paddy O’Hanlon

Opening Git commit messages in Sublime Text, particularly after moving from TextMate

Written from Girona, Catalonia

After switching from TextMate to Sublime Text I failed to update the setting to open Git commit messages in my new text editor many times. When I did git commit from the terminal, TextMate would open for me to log the commit message, which I liked a lot. I wanted that to work with Sublime.

The Sublime Text docs for working in the terminal on a Mac say, set up a symlink, so ‘subl’ can be used as a command. Like so:

ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

Then it seems that setting Sublime as ‘the editor for many commands’ would do the trick.

export EDITOR='subl -w'

Unfortunately it didn’t and TextMate kept launching when I committed.

The missing piece was that I forgot I had explicitly set TextMate as my Git editor. To update that I did:

git config --global core.editor "subl -n -w"

Here’s a video—sure to go viral—of my commit process: committing this post, writing the commit message in Sublime Text, and deploying to GitHub Pages.