Step-by-Step guide: Configuring Default text Editor for Git


Git is a powerful distributed version control system widely used in the software development world. It keeps track of changes made to files in your project, enabling multiple developers to work on the same project concurrently without overwriting each other’s changes. Git uses a text editor for various tasks such as editing commit messages, solving merge conflicts, modifying configuration files, etc.


Before you begin, it’s crucial to have Git installed on your system. If you haven’t done this yet, visit the Git download page and follow the instructions there. Knowledge of basic Git commands and workflows will be beneficial for following this guide but is not mandatory.

Understanding the Default Editor for Git

When Git needs you to input text, it launches what’s known as the ‘default editor.’ This default editor is a software application that Git opens whenever it needs you to enter text. The most common use case is when you run a command like git commit without the -m flag. Git opens your default text editor and lets you write a commit message.

Checking the Current Default Editor for Git

To identify your current default editor for Git, you need to execute a command in the terminal. This command queries Git’s global configuration to check the current set default editor:

git config --global --get core.editor

Upon running this command, the terminal displays the name of your current default editor.

How to Change the Default Editor in Git

For Windows Users:

Windows users can configure their preferred text editor as the default for Git using the git config command. For instance, if you want to set Notepad++ as your default editor, your command should look like this:

git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

This command tells Git to change the global configuration and set the core.editor value to the path where the Notepad++ executable resides. The flags -multiInst -notabbar -nosession -noPlugin ensure that Notepad++ opens a new instance when called by Git, without any tabs, sessions, or plugins.

For Linux/Mac Users:

On a Linux or Mac system, you also use the git config command to change the default editor. If you want to set Nano as your default editor, you should execute:

git config --global core.editor "nano"

This command sets the core.editor value to “nano” in the global Git configuration.

Setting up Popular Text Editors as Default

The commands for configuring popular text editors as the default for Git are as follows:


git config --global core.editor "vim"


git config --global core.editor "emacs"


git config --global core.editor "nano"

Sublime Text (Mac):

git config --global core.editor "subl -n -w"

VS Code:

git config --global core.editor "code --wait"

Each of these commands sets the core.editor configuration to a specific text editor. The “–wait” flag in the VS Code command tells Git to wait until the files are closed in the editor before it continues.

Troubleshooting Common Issues

If Git is not recognizing your new default editor or you are getting errors when Git tries to open it, make sure your command is spelled correctly. Windows users should verify the path to the text editor’s executable file.

For instance, if you’ve set Notepad++ as your default editor and are experiencing problems, ensure the path in the command leads to notepad++.exe.

Frequently Asked Questions (FAQs)

What is the default text editor for Git?

The default text editor in Git is the software that Git automatically opens when it needs you to input text, such as when you’re writing a commit message. The exact default editor varies depending on your system’s configuration. It’s often Vim or Vi on Unix-like systems, while it may be Notepad on Windows.

You can check your current default editor in Git by typing the following command in your terminal: git config --global --get core.editor. This command will output the name of your current default editor.

You can change your default text editor in Git by using the git config command. The specific command depends on the editor you want to set as your default. For example, if you want to set Nano as your default editor, you’d use the command git config --global core.editor "nano".

If you’re getting errors after setting a new default editor in Git, it may be because the path to your editor’s executable file is incorrect (this is particularly relevant for Windows users). Make sure the command you entered is spelled correctly and points to the right location.

Changing your default text editor in Git can make your workflow more comfortable and efficient. If you’re more familiar with a particular text editor or if a specific editor offers features that you find helpful, setting that editor as your default can enhance your productivity when working with Git.

In theory, you can use any text editor as your default in Git as long as Git can call it from the command line. However, the editor should ideally support plain text files, as many of Git’s tasks involve editing plain text files (like commit messages and configuration files).

Yes, you can use integrated development environments (IDEs) like Visual Studio Code or Sublime Text as your default text editor in Git. Specific commands are required to set them as your default, which were covered in the blog post.


Configuring your preferred text editor as the default in Git can significantly streamline your workflow. We’ve walked through checking the current default editor and setting a new one for both Windows and Linux/Mac users. The exact command varies depending on your operating system and the specific text editor you’re configuring.

Additional Resources

To learn more about Git configurations and how to optimize your setup, check out the official Git documentation. Here, you’ll find a wealth of information to help you become more proficient in using Git.

Related Articles