Recall & Review
beginner
What is the default branch name in Git when you create a new repository?
The default branch name is usually
main in modern Git versions. Older versions used master.Click to reveal answer
beginner
How can you check the current default branch name in your local Git repository?
You can run
git branch --show-current to see the current branch you are on, or check remote default with git remote show origin.Click to reveal answer
intermediate
How do you change the default branch name for new Git repositories globally?
Use the command
git config --global init.defaultBranch <branch-name> to set the default branch name for all new repositories you create.Click to reveal answer
intermediate
What command initializes a new Git repository with a custom default branch name?
Run
git init --initial-branch=<branch-name> to create a new repo with a specific default branch name.Click to reveal answer
beginner
Why might you want to change the default branch name from 'master' to 'main'?
Changing to
main is a modern convention to use more inclusive language and is now the default in Git and many platforms.Click to reveal answer
Which Git command sets the default branch name globally for new repositories?
✗ Incorrect
The command
git config --global init.defaultBranch main sets the default branch name for all new repositories you create.What is the default branch name used by Git versions before 2.28?
✗ Incorrect
Older Git versions used
master as the default branch name.How do you initialize a new Git repository with the default branch named 'develop'?
✗ Incorrect
Use
git init --initial-branch=develop to create a new repo with 'develop' as the default branch.Which command shows the current branch you are working on?
✗ Incorrect
git branch --show-current displays the name of the current branch.Why is 'main' preferred over 'master' as the default branch name?
✗ Incorrect
'main' is preferred to promote inclusive language; 'master' is still supported but less recommended.
Explain how to change the default branch name for all new Git repositories on your computer.
Think about a global Git configuration command.
You got /3 concepts.
Describe the difference between changing the default branch name for new repositories and renaming the branch in an existing repository.
Consider commands for new repo setup vs branch rename.
You got /3 concepts.