Recall & Review
beginner
What is a 'bad rebase' in Git?
A 'bad rebase' happens when the rebase process causes conflicts, lost commits, or an unwanted history, making the branch state incorrect or confusing.
Click to reveal answer
beginner
Which Git command helps you see the previous state before the rebase started?
The command
git reflog shows a log of all recent HEAD changes, including before the rebase, helping you find the commit to recover.Click to reveal answer
intermediate
How do you undo a bad rebase using Git?
Use
git reflog to find the commit before the rebase, then run git reset --hard <commit-hash> to restore your branch to that state.Click to reveal answer
beginner
What does
git rebase --abort do?It stops the current rebase process and returns your branch to the state before the rebase started, useful if you realize the rebase is going wrong.
Click to reveal answer
beginner
Why is it important to backup or check your branch before rebasing?
Because rebasing rewrites history, mistakes can cause lost commits or conflicts. Checking or backing up helps you recover easily if something goes wrong.
Click to reveal answer
Which command shows the history of HEAD changes to help recover from a bad rebase?
✗ Incorrect
git reflog tracks all recent HEAD movements, including before and after rebases, making it the best tool to find previous states.
What does
git rebase --abort do during a rebase?✗ Incorrect
This command cancels the rebase and returns your branch to how it was before starting the rebase.
If you lost commits after a bad rebase, what is the safest way to recover them?
✗ Incorrect
Using git reflog to find the last good commit and resetting hard to it recovers lost commits safely.
Why should you avoid rebasing shared branches without coordination?
✗ Incorrect
Rebasing changes commit history, which can cause problems if others have based work on the original commits.
What is the first step to recover from a bad rebase?
✗ Incorrect
Finding the commit before the rebase using git reflog is essential to know where to reset your branch.
Explain how to safely undo a bad rebase using Git commands.
Think about how to find the old state and restore it.
You got /3 concepts.
Describe why rebasing can cause problems and how to avoid losing work.
Consider what rebasing changes and how to prepare.
You got /4 concepts.