I'm trying out Git on Windows. I got to the point of trying "git commit" and I got this error:
Terminal is dumb but no VISUAL nor EDITOR defined. Please supply the message using either -m or -F option.
So I figured out I need to have an environment variable called EDITOR. No problem. I set it to point to Notepad. That worked, almost. The default commit message opens in Notepad. But Notepad doesn't support bare line feeds. I went out and got Notepad++, but I can't figure out how to get Notepad++ set up as the %EDITOR%
in such a way that it works with Git as expected.
I'm not married to Notepad++. At this point I don't mind what editor I use. I just want to be able to type commit messages in an editor rather than the command line (with -m
).
Those of you using Git on Windows: What tool do you use to edit your commit messages, and what did you have to do to make it work?
Vim/Gvim works well for me.
This is my setup to use Geany as an editor for git:
with the following content in geany.bat :
It works in both DOS console and msysgit.
Edit .gitconfig file in c:\Users\YourUser folder and add:
Resurrecting an old thread, but I found a a beautifully simple solution posted here - although there may be a mistake in the path in which you have to copy over the "subl" file given by the author. I am running Win 7 x64 and I had to put the "subl" file in my
/Git/cmd/
folder to make it work. It works like a charm though.I also use Cygwin on Windows, but with
gvim
(as opposed to the terminal-basedvim
).To make this work, I have done the following:
git_editor.bat
) which contains the following:"C:/Program Files/Vim/vim72/gvim.exe" --nofork "%*"
git_editor.bat
on in myPATH
.GIT_EDITOR=git_editor.bat
With this done,
git commit
, etc. will correctly invoke the gvim executable.NOTE 1: The
--nofork
option to gvim insures that it blocks until the commit message has been written.NOTE 2: The quotes around the path to gvim is required if you have spaces in the path.
NOTE 3: The quotes around "%*" are needed just in case git passes a file path with spaces.
I managed to get the environment version working by setting the EDITOR variable using quotes and
/
: