Thursday, 8 August 2019

GIT: HOW TO SET OR CHANGE DEFAULT EDITOR?

Every user have their favorate editor. Some use VI other uses emacs. This post will help you on how to see what is the text editor in GIT and how change it to your favorate editor. Changing an editor is done in many ways for GIT, either we can edit main git configuration file ~/.gitconfig or we can use "git config" command to set it.

SO WHAT IS MY DEFAULT EDITOR FOR MY GIT?

To know it we have to use git command or open ~/.gitconfig file.
 git config core.editor
Output:
 ○ → git config core.editor

 vim
or
 grep editor ~/.gitconfig

  
 Output:
        editor = vim

Change default GIT editor to your favorate one with a command
 git config --global core.editor editor_name
Example: I want to set vim as my default editor to do that follow below command
 git config --global core.editor vim
change default GIT editor by editing ~/.gitconfig
Enter below entry in to the file under [core] section
 editor = vim
Check if your editor is updated or not with following commands
 git config core.editor

 or
grep editor ~/.gitconfig

0 comments:

Post a Comment