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:
- [Solved] Mic not working on iPhone 7 after iOS 14 upgrade - Apple
- Mac Auto Move Mouse Pointer Every X Seconds to Keep Screen Awake - MacOS
- How to Select All Text in Vim/Vi editor - vi
- Steps to Change the Default Admin Password in Jenkins - Linux
- Google Chrome Update failed (error: 12) - Chrome
- How to display Toast on Button Click : Android - Android
- How to Stop Screen Recording on Mac - MacOS
- How to upgrade pip/pip3 package installer for Python - PIP