0
0
Gitdevops~5 mins

git rebase basic usage - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the git rebase command do?
It moves or combines a sequence of commits to a new base commit, helping to keep a clean, linear project history.
Click to reveal answer
beginner
How do you start a basic rebase of your current branch onto main?
Use git rebase main while on your feature branch to replay your commits on top of main.
Click to reveal answer
intermediate
What should you do if you encounter conflicts during a rebase?
Resolve the conflicts manually, then run git rebase --continue to proceed with the rebase.
Click to reveal answer
intermediate
What is the difference between git merge and git rebase?
git merge combines histories creating a merge commit; git rebase rewrites history to create a linear sequence of commits.
Click to reveal answer
intermediate
Why should you avoid rebasing public branches?
Because rebasing rewrites history, it can confuse others who have based work on the original commits, causing conflicts.
Click to reveal answer
What command rebases your current branch onto the main branch?
Agit merge main
Bgit pull origin main
Cgit checkout main
Dgit rebase main
If a conflict happens during rebase, what is the next step?
ARun <code>git merge</code> to fix conflicts
BAbort the rebase with <code>git rebase --abort</code>
CResolve conflicts and run <code>git rebase --continue</code>
DDelete the branch and start over
What does rebasing do to your commit history?
ACreates a merge commit
BRewrites commits on top of another base
CDeletes all commits
DPushes commits to remote
Which is a risk of rebasing a public branch?
AConfusing collaborators due to rewritten history
BLosing all commits permanently
CAutomatically merging conflicts
DDeleting the remote repository
Which command cancels an ongoing rebase and returns to the original state?
Agit rebase --abort
Bgit reset --hard
Cgit merge --abort
Dgit checkout -- .
Explain the basic steps to perform a git rebase of your feature branch onto the main branch.
Think about how you move your work on top of the latest main branch.
You got /5 concepts.
    Describe why rebasing can be useful and when it should be avoided.
    Consider the benefits of clean history and the risks of changing shared history.
    You got /5 concepts.