I’m working in Visual Studio 2010, but using Git from the command line (for now, at least). When I do a git commit, it opens some editor I don’t know.
I’ve been able to set Notepad as the commit message editor like this:
git config --global core.editor notepad.exe
I was able to get it to use Visual Studio 2010 like this:
git config --global core.editor "'C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/devenv.exe'"
But what I want to do is set git to use an already-running instance of Visual Studio 2010, if possible.
The /Edit command line switch for devenv.exe is supposed to be able to do this, but what syntax should I use in the git config line?
EDIT: It appears that this works…but not entirely:
git config --global core.editor "'C:/Program Files (x86)/Microsoft Visual Studio 10.0/Common7/IDE/devenv.exe' -edit"
I say “not entirely” because, while it does indeed open the commit message file in the running instance of VS 2010, git also immediately gives me the “There was a problem with the editor” message. And saving the file doesn’t do anything. It seems as if git expects the commit message editor to open (rather than already be open), and to close when the message is complete.
I would recommend using Notepad2 or Notepad++. They are developer oriented editors but still quite simple and easy to use. They will handle the line endings just fine (which is the problem with mixing notepad.exe with git). Notepad2 is a better choice than Notepad++ in this case IMO.