If you want to change the default editor that is used when you diff or commit to git, you need to make use of the git config command to set the global value for core.editor
Example 1: To set the editor as vi (or vim)% git config --global core.editor vi
Example 2: To set the editor as nano
% git config --global core.editor nano
Example 3: To set the editor as sublime
% git config --global core.editor "subl -n -w"
Example 4: To set the editor as visual studio code (vscode)
% git config --global core.editor "code -w"
Example 5: To set the editor as Nodepad++
% git config --global core.editor "C:/Program Files/Notepad++/notepad++.exe' -multiInst"
Example 6: To set the editor as Atom
% git config --global core.editor "atom -w"
Once you set your favorite editor, you will see that the commit command opens it up!
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Changes to be committed:
# new file: a.txt
#
~
~
~
~
"/myproj/.git/COMMIT_EDITMSG" 8L, 206B 1,0-1
More Posts related to Git,
- Change the default git branch name from master to main
- [Fixed] Git Clone git@github.com: Permission denied (publickey) Could not read from remote repository Fatal error
- [Solution] fatal: not a git repository (or any of the parent directories): .git
- [fix] zsh: command not found: git
- How to Install Git on Windows
- Setup Git + Visual Studio Code Tutorial
- How to undo last Git Commit on Local Repository?
- Install GitHub Command Line Tool on Mac
- How to Create a Git Branch in 6 Different ways
- Fix Git: Warning: could not find UI helper GitHub.UI on Windows
- Git Config Command - A Deep Dive
- Step-by-Step: How to delete a git branch from local as well as remote origin
- How to Add Git Bash Option to Windows Terminal List
- Command to Clone Repository Using Git Bash
- How to remove or unstage a file from git staged area
- Get the file location of git config values
- GitHub: How to Search Code
- How to check your installed version of Git
- Fix: error: src refspec master does not match any failed to push some refs to Git
- Git: Step-by-Step - How to Push Local Brach to GitHub
- How to Merge Branch into Master Branch
- fix fatal: --local can only be used inside a git repository error
- Fix: Git Pull Error: unable to resolve reference refs/remotes/origin/master: reference broken
- Change the default diff or commit editor for git
- Git Fix: fatal: refusing to merge unrelated histories Error
More Posts:
- Java Generics explained with simple definition and examples - Java
- How to run a Maven jar project from eclipse without tomcat - Eclipse
- Chrome : When Adobe flash player has finished updating, reload this page to active it - Chrome
- How to change the font in TextEdit on Mac - MacOS
- How to Install MongoDB in VSCode - HowTos
- [Fix] reCAPTCHA not working in Web Browser - Google
- Get HTML table td, tr or th inner content value with id or name attribute - Html
- Free Unlimited Calls from MTNL & BSNL Landlines from 1st May 2015 - HowTos