AlgoMaster Logo

Branching - Quiz

Last Updated: January 3, 2026

Branching Exercises

30 quizzes

1
Code Completion

Create a new branch from the currently checked-out commit without switching to it

shell
1
git feature/refactor-auth

Click an option to fill the blank:

2
Code Completion

Move to an existing branch named feature/payment using the recommended modern command

shell
1
git feature/payment

Click an option to fill the blank:

3
Code Completion

Create and immediately switch to a new branch called hotfix/header from your current commit using git switch

shell
1
git switch - hotfix/header

Click an option to fill the blank:

4
Code Completion

Safely delete a fully merged local branch named feature/old-ui

shell
1
git branch - feature/old-ui

Click an option to fill the blank:

5
Code Completion

Rename the current branch to feature/new-dashboard

shell
1
git branch -m feature/new-dashboard

Click an option to fill the blank:

6
Multiple Choice

What does a branch represent in Git?

7
Multiple Choice

Which command is recommended for simply switching between branches in modern Git?

8
Multiple Choice

What does HEAD usually point to in a normal (non-detached) state?

9
Multiple Choice

Which situation will put you into a detached HEAD state?

10
Multiple Choice

After deleting a fully merged local branch with git branch -d feature/login, what happens to its commits?

11
Sequencing

Order the steps to create a new feature branch from main using git switch, work on it, and then return to main.

Drag and drop to reorder, or use the arrows.

12
Sequencing

Order the steps to safely delete a completed local feature branch after merging.

Drag and drop to reorder, or use the arrows.

13
Sequencing

Order the steps to inspect an old commit in detached HEAD and then preserve work done there.

Drag and drop to reorder, or use the arrows.

14
Sequencing

Order the steps to rename a local branch and update the remote to use the new name.

Drag and drop to reorder, or use the arrows.

15
Output Prediction

You are currently on a branch called feature/login. What will this command print?

1git branch --show-current
16
Output Prediction

HEAD currently points to branch main. What will this command print?

1git symbolic-ref --short HEAD
17
Output Prediction

You run this command while on branch bugfix/header-overlap. What is printed?

1git rev-parse --abbrev-ref HEAD
18
Output Prediction

You are in a detached HEAD state at commit abc1234. What will this command print?

1git rev-parse --abbrev-ref HEAD
19
Bug Spotting

Find the incorrect command in this branching workflow that aims to create and switch to a new branch with git switch.

Click on the line(s) that contain the bug.

shell
1
git switch main
2
git switch -b
3
git status
4
git branch
20
Bug Spotting

Identify the incorrect command in this attempt to delete a local branch after work is done.

Click on the line(s) that contain the bug.

shell
1
git switch main
2
git merge feature/cleanup
3
git branch --delete --force feature/cleanup
21
Bug Spotting

You want to rename a local branch and then push it. Find the mistake.

Click on the line(s) that contain the bug.

shell
1
git switch feature/typo-naem
2
git branch -m feature/correct-name
3
git push origin --delete feature/correct-name
4
git push origin feature/correct-name
22
Matching

Match each branch-related command with its purpose.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

23
Matching

Match the HEAD-related concepts to their descriptions.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

24
Matching

Match each branch switching command to its typical use.

Click an item on the left, then click its match on the right. Click a matched item to unmatch.

25
Fill in the Blanks

Complete the commands to create a branch from main, push it to origin, and then list all branches.

shell
1
git switch
2
git switch -b
3
git push origin
4
git branch

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the commands to delete a remote branch and then list only remote branches.

shell
1
git push origin --delete
2
git branch

Click an option to fill blank 1:

27
Fill in the Blanks

Complete the commands to recover from detached HEAD by creating and switching to a new branch at the current commit.

shell
1
git new-experiment
2
git new-experiment

Click an option to fill blank 1:

28
Hotspot Selection

Select the line that shows HEAD is currently attached to the main branch.

Click on the line to select.

shell
1
  feature/auth
2
* main
3
  bugfix/navbar
29
Hotspot Selection

Click the part that indicates the current branch in this git status output.

Click on the line to select.

shell
1
On branch feature/search
2
Your branch is up to date with 'origin/feature/search'.
3
 
4
nothing to commit, working tree clean
30
Hotspot Selection

Select the line that indicates you are in a detached HEAD state.

Click on the line to select.

shell
1
HEAD detached at abc1234
2
nothing to commit, working tree clean