Make Visual Studio Code Default Editor in Git Post Install

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.

If Git is not installed yet, start with the step-by-step guide to install Git for Windows, then return here to set VS Code as the editor.

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

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 1; the step instructs the user to right click the windows icon.

Right click the windows icon

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 2; the step instructs the user to right click the windows icon.

Advanced system settings

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 3; the step instructs the user to right click the windows icon.

Environment Variables

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 4; the step instructs the user to select Path > Edit.

Select Path > Edit

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 5, showing Edit environment variable; the step instructs the user to select Path > Edit.

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

Windows Edit Environment Variable dialog with the Visual Studio Code bin directory added to the PATH list.

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

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 7; the step instructs the user to add the Visual Studio Code bin folder under Program Files to the path.

OK

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 8; the step instructs the user to add the Visual Studio Code bin folder under Program Files to the path.

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

Screenshot from the Set Visual Studio Code as the Git Editor walkthrough at step 9; the adjacent article text explains that in your Git Bash type the following command.

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.

Continue reading

Establish SSH Connection between Local Git & GitHub

Explore another guide in this topic and build on what you have just read. Read the article

1 thought on “Make Visual Studio Code Default Editor in Git Post Install”

Leave a Comment

Discover more from Digital Thought Disruption

Subscribe now to keep reading and get access to the full archive.

Continue reading