Member-only story

How to change the default commit editor in Git CLI. Bonus: how to fix VS Code Editor error in Mac OS

Bryant Jimin Son
4 min readMar 26, 2023

--

If you worked with Git CLI (Command Line Interface) tool in your local environment, you might have stumbled across a weird looking editor that opened when you type in git commit command. Now, for those who are using Mac OS or Linux environment, you may be familiar with VI/VIM editor already. It kinda looks like this.

git commit in Mac OS or Linux will open with VI/VIM by default

If you are familar with VI/VIM, great! You can just add some commit message, save the file with x! or :wq command and complete the process.

But if you are not too much familiar with VI/VIM editor, you might wonder what are you supposed to do next. Because of that, I often recommend other git beginners to just add -m argument, so it can commit with one line without asking a prompt. For example, it looks like this:

git commit -m “Your commit message”

That is fine, but how you can you avoid going through the process every time? Or, what if you already have your favorite text editor that you want to use?

You can set core.editor config property to set your default editor that opens with git commit.

It looks like this:

$ git config --global core.editor emacs

--

--

Bryant Jimin Son
Bryant Jimin Son

Written by Bryant Jimin Son

A cloud practitioner talking about technology, travels & career tips. But I will sometimes cover financial advises and some random stuffs.

No responses yet