Bird
0
0

What will be the result of running git config --local init.defaultBranch feature inside an existing repository?

medium📝 Command Output Q5 of 15
Git - Configuration and Aliases
What will be the result of running git config --local init.defaultBranch feature inside an existing repository?
ASets the default branch name to 'feature' only for new repos initialized inside this repo
BChanges the current branch name to 'feature'
CThrows an error because init.defaultBranch cannot be set locally
DSets the default branch name to 'feature' for this repository only
Step-by-Step Solution
Solution:
  1. Step 1: Understand --local scope in git config

    The --local flag sets configuration for the current repository only.
  2. Step 2: Effect of setting init.defaultBranch locally

    This sets the default branch name for new repos initialized inside this repo or for commands that respect local config.
  3. Final Answer:

    Sets the default branch name to 'feature' for this repository only -> Option D
  4. Quick Check:

    --local sets config for current repo only [OK]
Quick Trick: Use --local to set config for current repo only [OK]
Common Mistakes:
  • Confusing local config with changing current branch
  • Thinking it affects new repos outside current repo
  • Assuming error on valid local config

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes