Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the purpose of setting an editor in Git configuration?
Setting an editor in Git configuration tells Git which text editor to open when you need to write commit messages or edit other text files during Git operations.
Click to reveal answer
beginner
How do you set Vim as the default editor for Git?
You run the command: git config --global core.editor "vim". This sets Vim as the editor for all Git commands that require text editing.
Click to reveal answer
beginner
What command shows the current editor configured in Git?
Use git config --global core.editor to see which editor is set globally for Git.
Click to reveal answer
intermediate
Why might you want to configure a different editor for Git than your system default?
You might prefer a simpler or more powerful editor for writing commit messages, or your system default editor might not be comfortable or available in the terminal.
Click to reveal answer
intermediate
How can you set Nano as the editor for Git only in the current repository?
Run git config core.editor "nano" without the --global flag. This sets Nano as the editor only for the current Git repository.
Click to reveal answer
Which Git command sets the default editor globally?
Agit config --global core.editor "code"
Bgit set editor global "code"
Cgit editor set --global "code"
Dgit config editor --global "code"
✗ Incorrect
The correct syntax is git config --global core.editor "code" to set the editor globally.
What happens if you do not set an editor in Git?
AGit will not allow commits
BGit uses Vim by default
CGit opens a web browser for commit messages
DGit uses the system default editor
✗ Incorrect
If no editor is set, Git uses the system default editor to open commit messages.
How do you check the editor configured for Git in the current repository only?
Agit config core.editor
Bgit config --global core.editor
Cgit editor show
Dgit config --list
✗ Incorrect
Running git config core.editor shows the editor set for the current repository.
Which of these editors is commonly used in Git configuration for simplicity?
APhotoshop
BEmacs
CNano
DExcel
✗ Incorrect
Nano is a simple terminal-based editor often used with Git.
What does the command git config --global core.editor "code --wait" do?
ASets Vim as the editor
BSets Visual Studio Code as the editor and waits for you to finish editing
COpens code without waiting
DSets the editor to Nano
✗ Incorrect
The --wait flag tells Git to wait until you close Visual Studio Code before continuing.
Explain how to configure a text editor for Git and why it is useful.
Think about how Git opens text editors during commits.
You got /3 concepts.
Describe the difference between setting an editor globally and locally in Git.
Consider where the configuration applies.
You got /3 concepts.
Practice
(1/5)
1. What does the Git configuration setting core.editor control?
easy
A. The text editor Git uses for commit messages and other editing tasks
B. The default branch name for new repositories
C. The username for Git commits
D. The remote repository URL
Solution
Step 1: Understand the purpose of core.editor
This setting tells Git which text editor to open when you need to write commit messages or other text inputs.
Step 2: Identify what core.editor does not control
It does not affect branch names, usernames, or remote URLs, which are controlled by other settings.
Final Answer:
The text editor Git uses for commit messages and other editing tasks -> Option A
Quick Check:
core.editor = text editor setting [OK]
Hint: core.editor sets your commit message editor [OK]
Common Mistakes:
Confusing core.editor with branch or user settings
Thinking it sets remote URLs
Assuming it changes Git commands behavior
2. Which of the following is the correct command to set Vim as the default editor for Git globally?
easy
A. git config --global core.editor nano
B. git config --global core.editor vim
C. git set core.editor vim
D. git config core.editor --global vim
Solution
Step 1: Recall the correct syntax for setting Git config globally
The correct command uses git config --global core.editor <editor>.
Step 2: Identify the correct placement of options and editor name
git config --global core.editor vim correctly places --global before the key and sets the editor to vim.
Hint: Use 'git config --global core.editor editorname' [OK]
Common Mistakes:
Swapping order of --global and key
Using 'git set' instead of 'git config'
Placing --global after the key
3. Given the command git config --global core.editor "code --wait", what happens when you run git commit?
medium
A. Git opens VS Code and waits until you close it before completing the commit
B. Git opens VS Code but immediately completes the commit without waiting
C. Git throws an error because of the spaces in the command
D. Git uses the default editor ignoring this setting
Solution
Step 1: Understand the meaning of code --wait
The --wait flag tells VS Code to pause Git until the editor window is closed.
Step 2: Predict Git's behavior on commit
Git will open VS Code and wait for you to finish editing the commit message before proceeding.
Final Answer:
Git opens VS Code and waits until you close it before completing the commit -> Option A
Quick Check:
Editor with --wait pauses Git until done [OK]
Hint: Use --wait flag so Git waits for editor to close [OK]
Common Mistakes:
Ignoring the --wait flag effect
Assuming Git commits immediately
Thinking spaces cause errors without quotes
4. You set your editor with git config --global core.editor "code", but when you run git commit, Git does not wait for VS Code to close and commits immediately. What is the likely problem?
medium
A. VS Code does not support the -w option
B. You need to add a --wait flag for Git to wait
C. The command should be git config core.editor code without quotes
D. Git requires the editor command to block until exit, but VS Code runs in background
Solution
Step 1: Understand Git's requirement for editors
Git expects the editor command to block (wait) until the editor closes to capture the commit message.
Step 2: Analyze VS Code behavior
VS Code runs asynchronously by default and returns control to Git immediately unless --wait is specified.
Final Answer:
Git requires the editor command to block until exit, but VS Code runs in background -> Option D
Quick Check:
Editor must block Git until done [OK]
Hint: Editor must block Git until closed to save commit [OK]
Common Mistakes:
Assuming code blocks by default
Removing quotes causing parsing errors
Expecting Git to add --wait automatically
5. You want to configure Git to use Emacs as your editor, but only for a single repository, not globally. Which command correctly sets this?
hard
A. git config local core.editor emacs
B. git config --global core.editor emacs
C. git config core.editor emacs
D. git config --system core.editor emacs
Solution
Step 1: Understand Git config scopes
Global config applies to all repos, local config applies to current repo only, system config applies to all users on the machine.
Step 2: Identify the correct command for local repo setting
Using git config core.editor emacs without --global or --system sets the editor only for the current repository.
Final Answer:
git config core.editor emacs -> Option C
Quick Check:
Local config = no --global or --system [OK]
Hint: Omit --global to set editor for current repo only [OK]