0
0
Gitdevops~5 mins

Interactive rebase (git rebase -i) - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of git rebase -i?
It allows you to edit, reorder, squash, or remove commits in a branch history before sharing it.
Click to reveal answer
beginner
In an interactive rebase, what does the command pick mean?
It means to keep the commit as is during the rebase process.
Click to reveal answer
intermediate
What does the squash command do in git rebase -i?
It combines the current commit with the previous one, merging their changes and messages.
Click to reveal answer
beginner
How do you start an interactive rebase to edit the last 3 commits?
Run git rebase -i HEAD~3 to open the last 3 commits for editing.
Click to reveal answer
intermediate
What happens if you reorder commits in the interactive rebase editor?
Git will replay the commits in the new order, changing the commit history accordingly.
Click to reveal answer
What does git rebase -i HEAD~4 do?
AOpens the last 4 commits for interactive editing
BDeletes the last 4 commits
CCreates 4 new commits
DPushes 4 commits to remote
Which command in the interactive rebase editor combines commits?
Apick
Bedit
Cdrop
Dsquash
If you want to completely remove a commit during interactive rebase, which command do you use?
Apick
Bdrop
Cedit
Dreword
What does the edit command do in an interactive rebase?
AStops to allow changes to the commit
BKeeps the commit unchanged
CDeletes the commit
DCombines commits
After finishing an interactive rebase, what should you do if you already pushed the original commits?
ANothing, just continue working
BDelete the remote branch
CForce push the branch to update remote history
DCreate a new branch
Explain how to use git rebase -i to combine two commits into one.
Think about opening commits for editing and merging them.
You got /4 concepts.
    Describe what happens when you reorder commits during an interactive rebase.
    Imagine rearranging steps in a recipe.
    You got /4 concepts.