Challenge - 5 Problems
Interactive Rebase Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output of this interactive rebase command?
You run
git rebase -i HEAD~3 and change the second commit's action from pick to edit. After saving and closing the editor, what happens next?Attempts:
2 left
💡 Hint
Remember that
edit pauses the rebase to let you change the commit.✗ Incorrect
Using
edit in interactive rebase pauses the process after applying the previous commit, allowing you to amend the current commit before continuing.🧠 Conceptual
intermediate1:30remaining
What is the purpose of the
reword command in git rebase -i?During an interactive rebase, you see the option to change a commit's action to
reword. What does this do?Attempts:
2 left
💡 Hint
Think about changing only the commit message.
✗ Incorrect
The
reword command lets you edit the commit message during rebase without changing the commit's content.🔀 Workflow
advanced2:30remaining
What is the correct sequence to squash the last two commits into one using interactive rebase?
You want to combine the last two commits into a single commit with a new message. Which sequence of commands and actions is correct?
Attempts:
2 left
💡 Hint
Start by telling git which commits to rebase, then mark the second commit to squash.
✗ Incorrect
First, you start the interactive rebase for the last two commits, then mark the second commit as 'squash', save the file, and finally edit the combined commit message.
❓ Troubleshoot
advanced1:30remaining
What error occurs if you try to rebase a branch with uncommitted changes?
You run
git rebase -i HEAD~3 but have uncommitted changes in your working directory. What error message will git show?Attempts:
2 left
💡 Hint
Git protects your uncommitted changes from being overwritten during rebase.
✗ Incorrect
Git refuses to start a rebase if you have uncommitted changes, showing 'error: Your local changes to the following files would be overwritten by merge.'
✅ Best Practice
expert2:00remaining
Which practice is recommended when rewriting public commit history with
git rebase -i?You want to clean up commits on a branch that others have already pulled. What is the best practice before pushing rewritten commits?
Attempts:
2 left
💡 Hint
Consider safety and communication when rewriting shared history.
✗ Incorrect
Force pushing with
--force-with-lease is safer than plain force push and should be done only after informing your team to avoid overwriting others' work.