Git Branch Creation Quiz
Master the art of parallel development. Learn how to create, name, and manage branches to isolate your work and keep your repository organized.
Question 1
What is a 'branch' in Git, technically speaking?
Question 2
Which command creates a new branch named `feature-login` but *does not* switch to it?
Question 3
You want to create a new branch named `bugfix/header` and switch to it immediately. Which command is the modern, recommended way to do this?
Question 4
Which of the following is NOT a valid branch name in Git?
Question 5
You run `git branch` and see a list of branches. What does the asterisk `*` next to one of the names indicate?
Question 6
You want to see all branches, including those on the remote server (like `origin/main`). Which command should you use?
Question 7
You want to create a new branch `hotfix` starting from a specific commit `a1b2c3d`, not from the current HEAD. How do you do this?
Question 8
What is the purpose of using slashes in branch names, like `feature/login-page` or `users/john/experiment`?
Question 9
You try to create a branch named `HEAD`. Git rejects this. Why?
Question 10
Which command provides a visual text-based graph of your branches and merge history in the terminal?
Question 11
You are in a 'detached HEAD' state. You want to save your current state into a new branch named `backup`. What command do you run?
Question 12
You want to rename your current branch from `fetaure-x` (typo) to `feature-x`. Which command does this?
Question 13
Which command lists only the branches that have already been merged into your current branch?
Question 14
You create a branch `new-feature`. Does this action duplicate all the files in your project folder?
Question 15
You want to create a branch `v1.0-maintenance` starting specifically from a tag named `v1.0`. What is the command?
Question 16
What happens if you try to create a branch with a name that already exists?
Question 17
You want to see the last commit on each branch along with the branch name. Which flag adds this detail to the list?
Question 18
You want to create a completely empty branch with no parents and no files (e.g., for documentation or a completely separate project). Which command does this?
Question 19
How does Git know which branch is the 'default' branch (the one checked out when you clone)?
Question 20
You want to check which branches contain a specific commit (e.g., a bug fix `fix-123`). Which command helps?
Question 21
You accidentally deleted a branch that had work on it! You remember the branch name was `feature-z`. How can you find the commit SHA it pointed to so you can restore it?
Question 22
Are branch names case-sensitive in Git?
Question 23
You want to set a description for a branch to explain its purpose (without adding a commit). Which command allows this?
Question 24
What is the difference between `git branch -d` and `git branch -D`?
Question 25
You want to list branches sorted by the date of their last commit. Which command works?
Question 26
You want to create a branch `feature` that tracks `origin/feature` automatically. Which command does this?
Question 27
What does the command `git branch --no-merged` show?
Question 28
You want to verify exactly which commit a branch named `release` points to. Which command gives just the SHA-1?
Question 29
Can you have two branches pointing to the exact same commit?
Question 30
You want to change the default branch name for *all* new repositories you create on your computer from 'master' to 'main'. What is the command?
