How do you configure Git to use a specific text editor?

How do you configure Git to use a specific text editor?

a) git config --global core.editor "editor-name"
b) git set editor editor-name
c) git edit config editor-name
d) git commit --editor editor-name

Answer:

a) git config --global core.editor "editor-name"

Explanation:

You can configure Git to use a specific text editor by running the command git config --global core.editor "editor-name". This sets the default text editor for Git commands like git commit that open an editor.

For example, running git config --global core.editor "vim" sets Vim as the default text editor for Git.

This command ensures that Git uses the editor of your choice for editing commit messages and other text files.

Reference:

Top 100 Git and GitHub MCQ Questions and Answers

Scroll to Top