Click here to Skip to main content
15,885,910 members
Articles / Operating Systems / Windows
Tip/Trick

Update Editor for Git

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
1 Aug 2019CPOL1 min read 3.3K   3  
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)


Written By
Engineer
United States United States
Benktesh is a senior software engineer at Sony where he is a software developer/architect. His main focus when coding is quality, simplicity, and scalability and he is experienced in a broad range of subjects (software design, software development process, project management, testing, UI, multithreading, database, mobile development, and more).

Outside of professional work, there are always some side projects he is working on such as simulation modeling of financial, energy and emissions data and writing articles both technical and non-technical (see his blog at https://benktesh.blogspot.com/). While not coding, he is either reading books fiction and/or non-fiction, watching tv shows, trading stocks, and discussing climate change, global warming, emission trading, and traveling to meet people, place, and culture.

Comments and Discussions

 
-- There are no messages in this forum --