When using Git at the command line, I am wondering if it is possible to use Visual Studio Code as the default editor, i.e., when creating commit comments and looking at a diff of a file from the command line.
I understand that it won't be possible to use it for doing merges (at least at the minute), but does anyone know if it is possible to use it for looking at diff's, and if so, what command line options would be required in the .gitconfig file to make this happen?
UPDATE 1:
I have tried an approach similar to what I have done for Notepad++ in the past, i.e.,
#!/bin/sh
"c:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst -notabbar -nosession -noPlugin "$*"
And used:
#!/bin/sh
"C:\Users\gep13\AppData\Local\Code\app-0.1.0\Code.exe" "$*"
But this results in an error message:
C:\temp\testrepo [master +1 ~0 -0]> git commit
Output:
[8660:0504/084217:ERROR:crash_reporter_win.cc(70)] Cannot initialize out-of-process crash handler
Aborting commit due to empty commit message.
Visual Studio Code opens up correctly, with the expected content, but it isn't waiting on the response, i.e., clicking save and closing the window to return to the prompt.
UPDATE 2:
I have just heard back from one of the developers working on Visual Studio Code. It looks like this functionality currently isn't supported :-(
From a tweet:
"@gep13 @NathanGloyn @code I checked and what you want to do is currently not possible, unfortunately."
If you are interested in seeing this feature get added, you might want to think about adding your votes here:
Support Git configure diff and merge tools
UPDATE 3:
I have been reliably informed that this feature has been picked up by the Visual Studio Code team, so I am looking forward to a future release that will include it.
UPDATE 4:
Thanks to @f-boucheros comment below, I have been able to get Visual Studio Code working as the default editor for commit comments, rebase, etc. I would still like to see if it is possible to use it as the diff tool as well.
UPDATE 5:
As per the accepted answer for the question, this is now possible using the version 1.0 release of Visual Studio Code.