Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mTresk/6334991ba7e657e7583b09589f4bd613 to your computer and use it in GitHub Desktop.
Save mTresk/6334991ba7e657e7583b09589f4bd613 to your computer and use it in GitHub Desktop.

Revisions

  1. @geekmanager geekmanager revised this gist Mar 20, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions make-git-use-sublime.markdown
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # 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`
  2. @geekmanager geekmanager revised this gist Mar 20, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions make-git-use-sublime.markdown
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@ First up, let's make Sublime Text 2 available from the command line in terminal,
    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.)
  3. @geekmanager geekmanager renamed this gist Mar 20, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. @geekmanager geekmanager created this gist Mar 20, 2015.
    23 changes: 23 additions & 0 deletions make-git-use-sublime
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    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
    - [Launch Sublime Text 2 from Mac OSX Terminal]
    - [Associating editors with git]
    - [Sublime Text OSX command line]

    [Launch Sublime Text 2 from Mac OSX Terminal]: https://gist.github.com/olivierlacan/1195304
    [Associating editors with git]: https://help.github.com/articles/associating-text-editors-with-git/
    [Sublime Text OSX command line]: http://www.sublimetext.com/docs/2/osx_command_line.html