How to launch Visual Studio Code from git bash

This post shows the way to launch VS Code from your git bash.

At first, create a .bash_profile file at your home directory and add the following alias in your .bash_profile file.

reference url: How to open Visual Studio Code from git bash in Windows – Amateur Hour Programming

more

Just type cd ~/ on git bash then you can move your home directory.
if you could make the no-name file, like .bash_profile, on the file explorer, the file explorer warned you and didn’t allow to create no-name file. So it’s a easy way to create the no-name file on git bash.

Then edit the .bash_profile file on your editor.
If you want a one-line command, see the the following one.


By the way, the post on the reference url says not a .bash_profile but a .bashrc.
However, in my PCs, git bash didn’t read the .bashrc and another PC’s git bash warned “there is no .bash_profile.”. I guess .bash_profile is better.

There is an another way to add the alias into .bash_profile.

Though the path depends on your PC environment. So I prefer cmd.