3

I updated the git core.editor to VS Code using this command.

git config --global core.editor "'C:\Program Files (x86)\Microsoft VS Code\code.exe'"

Now if it do a git.commit the VS Code does open but git aborts the commit immediately like this:

PS C:\_git\gittestbed> git commit
Aborting commit due to empty commit message.

What else is needed for me git to wait until the data is entered and saved so that the commit accepts the commit message?

Update I tried two different syntax types but neither work.

PS C:\_git\gittestbed> git config --global core.editor "'C:\Program Files (x86)\Microsoft VS Code\code.exe -w'"
PS C:\_git\gittestbed> git commit
'C:\Program Files (x86)\Microsoft VS Code\code.exe -w': C:\Program Files (x86)\Microsoft VS Code\code.exe -w: No such fi
le or directory
error: There was a problem with the editor ''C:\Program Files (x86)\Microsoft VS Code\code.exe -w''.
Please supply the message using either -m or -F option.

PS C:\_git\gittestbed> git config --global core.editor "'C:\Program Files (x86)\Microsoft VS Code\code.exe' -w"
PS C:\_git\gittestbed> git commit
Aborting commit due to empty commit message.
enter code here

Update Using Notepad works. Seems as though VS Code returns too quickly for git or some other incompatibility.

git config --global core.editor notepad -w
ChiliYago
  • 11,341
  • 23
  • 79
  • 126

1 Answers1

1

add the -w flag to your configuration file.

git config --global core.editor "[your editor] -w"

Note

The -w is not documented but it actually exists. Try it before adding comments like : There's no documentation of any -w flag

CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • I can show you a screenshot of it working if you need me to. – CodeWizard Feb 20 '16 at 23:33
  • 4
    And I can show you a screenshot of it not working on my system, but I don't think anyone will be helped by screenshots. If it doesn't work reliably, an answer should say when it does and when it doesn't work, so that the OP can decide if it's good enough. (Or better yet, find something that does always work.) I'll take another look and see if I can find anything too. –  Feb 20 '16 at 23:37
  • I have been going over the git repo and it looks like the `-w/--wait` flag is only working under Unix system (+OSX) at the moment and is not supported for windows – CodeWizard Feb 20 '16 at 23:44
  • @hvd -w works for me too. Why this aggressive criticism? – alex Feb 21 '16 at 09:31
  • @dit I'm not sure where you're getting the aggression from, but if an answer says something works, I test it, I find it doesn't work, then that's a perfectly valid reason for criticism. Which OS are you on? codeWizard's last comment seems to indicate that the flag never works on Windows (which the OP is using). Is it working for you on Windows, or on some other OS? –  Feb 21 '16 at 10:35