0
0
Gitdevops~20 mins

git rebase basic usage - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Git Rebase Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
What is the output of this git rebase command?
You have a branch feature that is behind main. You run git rebase main while on feature. What happens?
AThe commits from <code>feature</code> are replayed on top of the latest <code>main</code> branch commits.
BThe <code>main</code> branch is reset to the state of <code>feature</code> branch.
CThe <code>feature</code> branch is merged into <code>main</code> creating a merge commit.
DThe <code>feature</code> branch is deleted and replaced by <code>main</code> branch.
Attempts:
2 left
💡 Hint
Think about what rebasing does: it moves your branch commits to a new base.
🧠 Conceptual
intermediate
2:00remaining
What does git rebase -i allow you to do?
Choose the best description of what interactive rebase (git rebase -i) enables.
AIt automatically merges two branches without conflicts.
BIt allows you to edit, reorder, squash, or remove commits before applying them.
CIt deletes the current branch and creates a new one.
DIt pushes commits directly to the remote repository.
Attempts:
2 left
💡 Hint
Interactive means you can choose what to do with each commit.
Troubleshoot
advanced
2:00remaining
You get a conflict during a git rebase. What is the correct next step?
During git rebase main, Git stops and shows a conflict. What should you do next?
ARun <code>git rebase --abort</code> to ignore the conflict and keep changes.
BRun <code>git merge main</code> to resolve the conflict automatically.
CDelete the branch and start over.
DFix the conflicting files manually, then run <code>git rebase --continue</code>.
Attempts:
2 left
💡 Hint
Rebase pauses for conflicts so you can fix them.
Best Practice
advanced
2:00remaining
When is it best to avoid using git rebase?
Choose the situation where using git rebase is NOT recommended.
AWhen you want to clean up your commit history before merging.
BWhen you want to update your feature branch with the latest main branch commits.
CWhen you have already pushed your branch to a shared remote repository used by others.
DWhen you want to combine multiple commits into one.
Attempts:
2 left
💡 Hint
Rebasing rewrites history which can confuse others if shared.
🔀 Workflow
expert
3:00remaining
What is the correct sequence to update a feature branch with the latest main branch changes using rebase?
Order these commands to properly update your feature branch with changes from main using rebase.
A2,1,3,4
B1,3,2,4
C1,2,3,4
D2,3,1,4
Attempts:
2 left
💡 Hint
First get latest remote changes, then switch branch, rebase, and push.