Make Git use Sublime Text

Although I’m happy using the command line, being able to use your favourite editor solves some problems.

For example, changing dozens of pick to squash when performing an interactive rebase just ain’t fun! (probably illustrating my uselessness at VI!).

First we need to make our editor Sublime Text available to the command line in terminal, by creating a link to it’s launcher:

ln -s /Applications/Sublime\ /usr/local/bin/sublime

Now tell git to use sublime:

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

(the -n = new window; -w = wait for file to be closed before returning. If you don’t use the latter option, Sublime doesn’t actually let you edit before returning to the in process git rebase or similar.)

Et voila, from now on when you do a rebase or similar, it should open in Sublime Text.