How to use Visual Studio Code as Default Editor for Git

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?


I have tried an approach similar to what I have done for Notepad++ in the past, i.e.


"c:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst -notabbar -nosession -noPlugin "$*"

And used:


"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
[8660:0504/] Cannot initialize out-of-process crash handler
Aborting commit due to empty commit message.
C:\temp\testrepo [master +1 ~0 -0]>

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 prompt.


I have just heard back from one of the developers working on VSCode. Looks like this functionality currently isn’t supported 🙁

If you are interested in seeing this feature get added, you might want to think about adding your votes here:


I have been reliably informed that this feature has been picked up by the VSCode team, so I am looking forward to a future release that will include it.


Thanks to @f-boucheros comment below, I have been able to get VS 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.


As per the accepted answer for the question, this is now possible using the V1.0 release of code.

  • How to pull specific remote into current branch in VS Code
  • VSCode “Discard all changes” any ways/list of ways to recover (even via system image)
  • VSCode Does Not Recognize Git Folders not in Root
  • How to manage more than one git repository in VS code
  • VS code Delete my Unity project (OS X)(git clean all)
  • Visual Studio Code cannot detect installed git
  • Your repository has no remotes configured to push to
  • Problems using GIT w/ SSH key file under Windows
  • 8 Solutions collect form web for “How to use Visual Studio Code as Default Editor for Git”

    In the most recent release (v1.0, released in March 2016), you are now able to use VS Code as the default git commit/diff tool. Quoted from the documentations:

    1. Make sure you can run code --help from the command line and you get

      • if you do not see help, please follow these steps:
        • Mac: Select Shell Command: Install ‘Code’ command in path from the Command
        • Windows: Make sure you selected Add to PATH during the
        • Linux: Make sure you installed Code via our new .deb or
          .rpm packages.
    2. From the command line, run git config --global core.editor "code --wait"

    Now you can run git config --global -e and use VS Code as editor for configuring Git.
    enter image description here
    Add the following to enable support for using VS Code as diff tool:

        tool = default-difftool
    [difftool "default-difftool"]
        cmd = code --wait --diff $LOCAL $REMOTE

    This leverages the new --diff option you can pass to VS Code to
    compare two files side by side.

    To summarize, here are some examples of where you can use Git with VS

    • git rebase HEAD~3 -i allows to interactive rebase using VS Code
    • git commit allows to use VS Code for the commit message
    • git add -p followed by e for interactive add
    • git difftool <commit>^ <commit> allows to use VS Code as diff editor for changes

    For what I understand, VSCode is not in AppData anymore.

    So Set the default git editor by executing that command in a command prompt window:

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

    The parameter -w, --wait is to wait for window to be closed before returning. Visual Studio Code is base on Atom Editor. if you also have atom installed execute the command atom --help. You will see the last argument in the help is wait.

    Next time you do a git rebase -i HEAD~3 it will popup Visual Studio Code. Once VSCode is close then Git will take back the lead.

    Note: My current version of VSCode is 0.9.2

    I hope that help.

    GitPad sets your current text editor as the default editor for Git.

    My default editor for .txt files in Windows 10 is Visual Studio Code and running GitPad once made it the default editor for Git. I haven’t experienced the problems mentioned in the question (Git waits until VS Code window is closed in my case).

    (The link for the .exe file didn’t work for me, you may need to compile the source yourself.)

    Im not sure you can do this, however you can try these additions in your gitconfig file.

    Try to replace the kdiff3 from these values to point to visual studio code executable.

    tool = kdiff3
    [mergetool "kdiff3"]
    path = C:/Program Files/KDiff3/kdiff3.exe
    keepBackup = false
    trustExitCode = false

    I opened up my .gitconfig and amended it with:

        editor = 'C:/Users/miqid/AppData/Local/Code/app-0.1.0/Code.exe'

    That did it for me (I’m on Windows 8).

    However, I noticed that after I tried an arbitrary git commit that in my Git Bash console I see the following message:

    [9168:0504/] Renderer process started

    Unsure of what the ramifications of this might be.

    Good news! At the time of writing, this feature has already been implemented in the 0.10.12-insiders release and carried out through 0.10.14-insiders. Hence we are going to have it in the upcoming version 1.0 Release of VS Code.

    Implementation Ref: Implement -w/–wait command line arg

    I set up Visual Studio Code as a default to open .txt file. And next I did use simple command: git config --global core.editor "'C:\Users\UserName\AppData\Local\Code\app-0.7.10\Code.exe\'". And everything works pretty well.

    Run this command in your Mac Terminal app

    git config --global core.editor "/Applications/Visual\ Studio\"
    Git Baby is a git and github fan, let's start git clone.