Use Visual Studio Code as your default text editor for Git
October 24, 2018
Single-line commit messages in git are easy from the command line:
git commit -m "<SOME_MESSAGE>"
But what about multi-line commit messages? If you’re comfortable with vi, which is what git uses by default when you run
git commit -m, then that’s fine, but I prefer to use a GUI text editor such as vscode.
I stumbled upon this stackoverflow thread recently that did just what I needed. I’ve consolidated the top answer and relevant comments.
This line will make git use vscode as the default text editor. The
--wait option will wait for the vscode window to be closed before returning control to the command line. The
--new-window option will open the commit message in a new vscode window, which keeps it from getting lost in a sea of tabs in your current vscode window.
git config --global core.editor "code --wait --new-window"
This line lets you edit your global config settings in vscode.
git config --global -e