Git & GitHub
December 19, 2021
In Git, how to change the default editor?
As you know, for many specific operations git opens a text editor. On macOS and Linux, this is Vim by default. Not the most beginner-friendly editor I'd say. To make you comfortable, set your favorite editor as the git editor with just one command:
git config --global core.editor "path to your editor with params"
Then check it by making a commit:
git commit --allow-empty
Your favorite editor should open. Write a commit message, save and close the file. See git log
to look for a commit. Is it there? If yes, you’re awesome.
Here are the commands for the popular editors:
VS Code
In VS Code press ⌘⇧P and select Shell Command: Install 'code' command in PATH from the list. Then run:
git config --global core.editor "code --wait"
TextEdit
git config --global core.editor "open -W -n"
Atom
git config --global core.editor "atom --wait"
Sublime Text 3
git config --global core.editor '"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" -n -w'