Make Visual Studio Code Default Editor in Git Post Install

Posted by

Sometimes, when deploying Git you may forget to select Visual Studio Code as your default editor.  I thought I would take a quick moment to show everyone how fast and easy you can change the default global editor in the Git Bash console.

First we must make sure VS Code is in the Path.

Right click the windows icon

Advanced system settings

Environment Variables

Select Path > Edit

As you can see the VS Code path is missing so click new

Add C:\Program Files\Microsoft VS Code\bin

OK

Easy way to confirm it worked is just type $ code into your Git Bash and t should open VS Code

In your Git Bash type the following command:

$ git config –global core.editor “code –wait –new-window”

VS Code should now be your global editor

–wait – make sure git bash will wait for code editor will be closed

–new-window will ensure that a new window is opened every time

Summary:
I’ve known a lot of first time people to Git and VS Code to install Git before VS Code and not select the option to have it be the default editor.  I hope this quick and easy article is helpful to y’all.

Leave a Reply