Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / operating-systems / Windows

Update Editor for Git

0.00/5 (No votes)
1 Aug 2019CPOL1 min read 3.5K  
Configure your favorite editor in git

Introduction

Our favorite text editor is where we want to edit certain texts. This also applies to cases when we want to edit commits in git. Example include squashing commits. There are many options for a text editor in our system with git config, we can use the editor of our choice within git.

I am going to provide a tip to set the favorite editor for git in Windows Machine. I am certain that this tip can be used in other Operating Systems as well. For demonstration, I am going to use NotePad++ as my favorite editor.

Set-Up Editor

There are two options to set the editor of our choice. We have to have the editor installed in the system and path to executable available. Then we can update the git setting either by command line or by updating the config file.

Let's first look at how we can achieve this by updating the config file.

Git global configs are available in .config file. Depending on your setting, it can be anywhere in the system. A simple search for '.config' would point us to the right file. In the config file, simply add the following line towards the end:

[core]
    editor = "'C:/Program Files (x86)/Notepad++/notepad++.exe' 
             -multiInst -notabbar -nosession -noPlugin"

Second, the same behavior can be obtained by passing value from the command line which essentially updates the .gitconfig file. Open the Git-Bash and execute the following command:

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

For an example of how this editor can be useful, please visit my article - Combine Multiple git commits into a Single commit in GIT using Squash.

History

  • 1st August, 2019: Created a tip

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)