Bird
0
0

Given these commands run in order inside a Git project:

medium📝 Command Output Q13 of 15
Git - Configuration and Aliases
Given these commands run in order inside a Git project:
git config --global user.name "GlobalUser"
git config user.name "LocalUser"
git config user.name

What will be the output of the last command?
AGlobalUser
BLocalUser
CNo output (empty)
DError: user.name not set
Step-by-Step Solution
Solution:
  1. Step 1: Understand config precedence

    Local config overrides global config when both exist for the same key.
  2. 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.
  3. Final Answer:

    LocalUser -> Option B
  4. Quick Check:

    Local overrides global, so output is LocalUser [OK]
Quick Trick: 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

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes