AlgoMaster Logo

Rebasing - Quiz

Last Updated: January 3, 2026

Rebasing Exercises

30 quizzes

1
Code Completion

Replay your current feature branch commits on top of the latest main branch to get a linear history before opening a pull request

shell
1
git main

Click an option to fill the blank:

2
Code Completion

Continue an in-progress rebase after resolving all reported conflicts

shell
1
git rebase

Click an option to fill the blank:

3
Code Completion

Start an interactive rebase to clean up the last 5 commits before sharing the branch

shell
1
git rebase HEAD~5

Click an option to fill the blank:

4
Code Completion

Rewrite your current branch so that its unique commits are based on the specified new base commit using the flexible three-argument form

shell
1
git rebase --onto 1a2b3c 4d5e6f

Click an option to fill the blank:

5
Code Completion

Amend the last commit during an interactive rebase when Git has paused at a commit you marked for editing

shell
1
git commit

Click an option to fill the blank:

6
Multiple Choice

What is the main effect of rebasing a feature branch onto main instead of merging main into it?

7
Multiple Choice

When should you avoid rebasing a branch?

8
Multiple Choice

During an interactive rebase, which action should you choose to combine a 'fix typo' commit into the previous commit while discarding the 'fix typo' message?

9
Multiple Choice

How does a rebase differ from a merge when integrating main into a feature branch?

10
Multiple Choice

Which interactive rebase action lets you split a single commit into multiple smaller commits?

11
Sequencing

Order the steps to rebase your feature branch onto updated main and resolve a single conflict

Drag and drop to reorder, or use the arrows.

12
Sequencing

Order the steps to squash the last three commits on your current branch into a single commit using interactive rebase

Drag and drop to reorder, or use the arrows.

13
Sequencing

Order the steps to split the last commit into two separate commits using interactive rebase

Drag and drop to reorder, or use the arrows.

14
Sequencing

Order the steps to use git rebase --onto to move a topic branch from old-base to new-base

Drag and drop to reorder, or use the arrows.

15
Output Prediction

You are on branch feature-login. What will this command print?

1git branch --show-current
16
Output Prediction

You are in the middle of a rebase and Git stopped at commit 'Refactor API'. What will this command output?

1git status --short --branch
17
Output Prediction

Your last commit message is 'Add search endpoint'. What does this command print?

1git log -1 --pretty=%s
18
Output Prediction

You are rebasing feature onto main and no conflicts remain. What will this command output?

1git rebase --continue 2>/dev/null || echo "FAILED"
19
Bug Spotting

Identify the incorrect command in this attempt to resolve a rebase conflict and continue

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

shell
1
git status
2
git add conflicted-file.js
3
git rebase -continue
4
git log --oneline -5
20
Bug Spotting

Find the incorrect command in this workflow for interactively editing the last 3 commits

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

shell
1
git rebase -i HEAD-3
2
git commit --amend
3
git rebase --continue
21
Bug Spotting

Find the incorrect command in this attempt to move a branch using rebase --onto

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

shell
1
git checkout topic
2
git rebase --onto old-base new-base topic
3
git push origin topic --force-with-lease
22
Matching

Match each rebase-related command with its primary purpose

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

23
Matching

Match interactive rebase actions with their effects on commits

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

24
Matching

Match the history-editing scenarios with the most appropriate Git command

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 start an interactive rebase and mark a specific commit for editing

shell
1
git rebase HEAD~3
2
# In the editor, change the first line from:
3
# abc123 Add API
4
# to:
5
# abc123 Add API

Click an option to fill blank 1:

26
Fill in the Blanks

Complete the commands to rebase a feature branch onto origin/main and handle a conflict

shell
1
git checkout
2
git fetch origin
3
git rebase
4
# after resolving conflicts
5
git add conflicted-file.js
6
git rebase

Click an option to fill blank 1:

27
Fill in the Blanks

Complete the commands to stop an in-progress rebase and restore the previous branch state

shell
1
git status
2
# decide to cancel the history rewrite
3
git rebase
4
# verify branch history again
5
git log --oneline

Click an option to fill blank 1:

28
Hotspot Selection

Select the line that shows you are in the middle of an interactive rebase

Click on the line to select.

shell
1
On branch feature-cleanup
2
You are currently rebasing branch 'feature-cleanup' on 'main'.
3
  (fix conflicts and run "git rebase --continue")
4
  (use "git rebase --skip" to skip this patch)
5
  (use "git rebase --abort" to check out the original branch)
6
 
7
Unmerged paths:
8
  both modified:   src/app.js
29
Hotspot Selection

Select the line that indicates which commit is currently being applied during a rebase

Click on the line to select.

shell
1
Applying: Add logging to payment flow
2
Using index info to reconstruct a base tree...
3
M	src/payment.js
30
Hotspot Selection

Select the line that shows the commit range being rebased

Click on the line to select.

shell
1
First, rewinding head to replay your work on top of it...
2
Applying: Add search API
3
Applying: Fix search API bug
4
Successfully rebased and updated refs/heads/feature-search.