The command to do this is git config --global core. editor "nano" . You can change the highlighted section with your editor of choice!
On Windows, if you use Git Bash the default editor will be Vim. Vim is another text editor, like nano or notepad.
The latest Build 2181 just added support for the -w
(wait) command line argument. The following configuration will allow ST2 to work as your default git editor on Windows. This will allow git to open ST2 for commit messages and such.
git config --global core.editor "'c:/program files/sublime text 2/sublime_text.exe' -w"
Sublime Text 3 (Build 3065) added the subl.exe
command line helper. Use subl.exe -h
for the options available to you. I have hot_exit: true
and remember_open_files: true
set in my Sublime Text user settings. I have found the following to git config to work well for me.
git config --global core.editor "'c:/program files/sublime text 3/subl.exe' -w"
Set Sublime as your editor for Git by typing the following command in the terminal:
git config --global core.editor "subl -n -w"
With this Git config, the new tab is opened in my editor. I edit my commit message, save the tab (Ctrl+S) and close it (Ctrl+W).
Git will wait until the tab is closed to continue its work.
You can use this command on Mac and Linux:
git config --global core.editor "subl -n -w"
For Mac & Sublime Text 3:
If git config --global core.editor "subl -n -w"
doesn't work, use this git config
command:
$ git config --global core.editor "'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl' -n -w"
Note: it does not contain escaping backslashes.
For Mac OS X in the file ~/.gitconfig under [core] I had to put this code to solve the issue on my end.
editor = /Applications/Sublime\\ Text.app/Contents/SharedSupport/bin/subl -n -w
This was when subl was working fine but git was unable to access it. And was displaying these errors
subl -n -w: subl: command not found
error: There was a problem with the editor 'subl -n -w'.
what worked for me in cygwin/zsh:
in /usr/local/bin create subl_git file
#!/bin/bash
/cygdrive/c/Program\ Files/Sublime\ Text\ 2/sublime_text.exe -w -n `cygpath -w $@`
in gitconfig:
editor = /usr/local/bin/subl_git
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With