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 difference between global and local configuration in Git?
Global configuration applies settings to all repositories for a user on a machine, while local configuration applies settings only to a specific repository.
Click to reveal answer
beginner
How do you set your user name globally in Git?
Use the command: git config --global user.name "Your Name" to set your user name for all repositories.
Click to reveal answer
beginner
How do you check the local Git configuration for a repository?
Run git config --local --list inside the repository folder to see local settings.
Click to reveal answer
intermediate
If a setting exists in both global and local Git configurations, which one takes effect?
The local configuration overrides the global configuration for that repository.
Click to reveal answer
intermediate
Where are Git global and local configuration files stored?
Global config is stored in ~/.gitconfig (user home directory). Local config is stored in .git/config inside the repository folder.
Click to reveal answer
Which command sets a Git configuration only for the current repository?
Local config overrides global config when both exist for the same key.
Step 2: Analyze the commands
First sets global user.name to "GlobalUser", then local user.name to "LocalUser". The last command reads the effective user.name, which is local.
Final Answer:
LocalUser -> Option B
Quick Check:
Local overrides global, so output is LocalUser [OK]
Hint: Local config overrides global for same key [OK]
Common Mistakes:
Assuming global config always shows
Thinking last set value globally is used
Confusing output with error
4. You ran git config --local user.name "Alice" but git config user.name still shows "Bob". What is the most likely problem?
medium
A. You are not inside a Git repository directory.
B. You used --local incorrectly; it should be --global.
C. The global config is overriding the local config.
D. The user.name key is misspelled.
Solution
Step 1: Check local config requirements
Local config applies only inside a Git repository folder. Outside, local config commands fail silently or do not apply.
Step 2: Understand why global shows instead
If outside a repo, local config is ignored, so global config value "Bob" is shown.
Final Answer:
You are not inside a Git repository directory. -> Option A
Quick Check:
Local config needs repo folder [OK]
Hint: Local config works only inside a Git repo folder [OK]
Common Mistakes:
Assuming global always overrides local
Using wrong option --global instead of --local
Misspelling config keys
5. You want to set your Git user email globally but override it with a different email for a specific project. Which sequence of commands achieves this?