Bird
0
0

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?

hard📝 Best Practice Q15 of 15
Git - Configuration and Aliases
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?
Agit config --global user.email "global@example.com"<br>git config --local user.email "project@example.com" (inside project)
Bgit config --local user.email "global@example.com"<br>git config --global user.email "project@example.com"
Cgit config user.email "global@example.com" (inside project)<br>git config --global user.email "project@example.com"
Dgit config --global user.email "project@example.com"<br>git config user.email "global@example.com" (inside project)
Step-by-Step Solution
Solution:
  1. Step 1: Set global email first

    Use git config --global user.email "global@example.com" to set the default email for all projects.
  2. Step 2: Override locally inside the project

    Inside the project folder, run git config --local user.email "project@example.com" to override the global email only for that project.
  3. Final Answer:

    git config --global user.email "global@example.com" followed by git config --local user.email "project@example.com" inside project -> Option A
  4. Quick Check:

    Global first, then local override inside project [OK]
Quick Trick: Set global first, then local inside project to override [OK]
Common Mistakes:
  • Setting local config before global
  • Using local config outside project folder
  • Confusing which email applies where

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes