Use Visual Studio Code as Your Default Text Editor for Git
Published: Oct 24, 2018
Updated: Jul 14, 2021
Updated: Jul 14, 2021
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
, 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