0
0
Gitdevops~5 mins

Squashing commits in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does 'squashing commits' mean in Git?
Squashing commits means combining multiple commits into one to make the history cleaner and easier to understand.
Click to reveal answer
beginner
Which Git command is commonly used to squash commits?
The command 'git rebase -i' (interactive rebase) is used to squash commits by editing the commit list.
Click to reveal answer
beginner
What is the main benefit of squashing commits before merging a feature branch?
It keeps the main branch history clean and easier to read by combining many small changes into one meaningful commit.
Click to reveal answer
intermediate
In an interactive rebase, what keyword do you replace 'pick' with to squash a commit?
You replace 'pick' with 'squash' or 's' to combine that commit with the previous one.
Click to reveal answer
intermediate
True or False: Squashing commits changes the commit history and can affect shared branches.
True. Squashing rewrites history, so it should be done carefully, especially if the branch is shared with others.
Click to reveal answer
What is the purpose of squashing commits in Git?
ATo combine multiple commits into one for a cleaner history
BTo delete commits permanently
CTo create a new branch
DTo push commits to remote
Which command starts an interactive rebase to squash commits?
Agit merge --squash
Bgit commit --amend
Cgit rebase -i
Dgit reset --hard
During interactive rebase, which keyword do you use to squash a commit?
Afixup
Bedit
Cdrop
Dsquash
What should you be careful about when squashing commits on a shared branch?
AIt rewrites history and can confuse collaborators
BIt can cause merge conflicts
CIt deletes the branch
DIt disables pushing
What happens to commit messages when you squash commits?
AThey are all deleted
BYou can combine and edit them into one message
CThey remain separate
DThey are automatically replaced with the first commit message
Explain the process of squashing commits using interactive rebase in Git.
Think about editing commits in a list and merging them.
You got /4 concepts.
    Why is it important to squash commits before merging a feature branch into the main branch?
    Consider how commit history looks to others.
    You got /4 concepts.