Bird
0
0

Which of the following is the correct syntax to set the default branch name to main for the current user only?

easy📝 Syntax Q3 of 15
Git - Configuration and Aliases
Which of the following is the correct syntax to set the default branch name to main for the current user only?
Agit config --local init.defaultBranch main
Bgit config --global init.defaultBranch main
Cgit config init.defaultBranch main
Dgit set defaultBranch main
Step-by-Step Solution
Solution:
  1. Step 1: Understand scope flags in git config

    The --global flag sets configuration for the current user globally.
  2. Step 2: Validate syntax correctness

    git config --global init.defaultBranch main is the correct syntax to set the default branch name globally.
  3. Final Answer:

    git config --global init.defaultBranch main -> Option B
  4. Quick Check:

    Set default branch globally = git config --global init.defaultBranch main [OK]
Quick Trick: Use --global flag to set user-wide default branch [OK]
Common Mistakes:
  • Using --local without a repository
  • Using incorrect commands like git set
  • Omitting the --global flag when needed

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes