Use Visual Studio Code as your default text editor for Git
Published: 2018-10-24 • Last updated: 2019-09-12
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.
git config --global core.editor "code --wait"
Then, use this snippet to edit your global config settings in vscode.
git config --global -e