Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielgomezrico/989ae12227cd53e634a339ae18d5427d to your computer and use it in GitHub Desktop.
Save danielgomezrico/989ae12227cd53e634a339ae18d5427d to your computer and use it in GitHub Desktop.
Making git use Sublime Text for rebase etc

Making git use Sublime Text

First up, let's make Sublime Text 2 available from the command line in terminal, by creating a link to subl which is the launcher from terminal:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

(added bonus of this approach is when you upgrade to ST3 or change text editor, you can just redirect the symlink).

If there's any chance that bash doesn't check usr/local/bin then use Launch Sublime Text 2 from Mac OSX Terminal for more detailed instructions on how to make this happen.

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.

Sources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment