How to configure Git editor
Setting your preferred text editor for Git operations like writing commit messages and interactive rebases improves your development workflow significantly.
As the creator of CoreUI with over 25 years of development experience, I’ve configured Git across hundreds of different development environments.
The most straightforward solution is to use the git config core.editor command to set your editor of choice globally or per repository.
This ensures Git always opens your preferred editor for interactive operations.
Use git config core.editor to set your preferred editor for Git operations.
# Set VS Code as Git editor
git config --global core.editor 'code --wait'
# Set Vim as Git editor
git config --global core.editor 'vim'
# Set Nano as Git editor
git config --global core.editor 'nano'
# Set Sublime Text as Git editor
git config --global core.editor 'subl -n -w'
The git config --global core.editor command sets your editor preference for all Git repositories on your system. The --wait flag (for VS Code) or -w flag (for Sublime) tells Git to wait until you close the editor before proceeding. Different editors require different command formats: VS Code uses code --wait, Vim uses vim, Nano uses nano, and Sublime Text uses subl -n -w. Without the wait flag, Git might proceed before you finish writing your message.
Best Practice Note
This is the same Git editor configuration we recommend for CoreUI contributors to ensure smooth commit workflows. Choose an editor you’re comfortable with for writing detailed commit messages. You can also set different editors for specific operations using environment variables like GIT_EDITOR for temporary overrides.



