0
0
Gitdevops~5 mins

When to rebase vs when to merge in Git - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What does 'git rebase' do?
It moves or reapplies your branch changes on top of another branch, creating a cleaner, linear history.
Click to reveal answer
beginner
What is the main effect of 'git merge'?
It combines two branches by creating a new commit that joins their histories, preserving all commits as they happened.
Click to reveal answer
intermediate
When should you prefer rebasing over merging?
Use rebase when you want a clean, linear history without extra merge commits, especially before sharing your work.
Click to reveal answer
intermediate
When is merging a better choice than rebasing?
Merge when you want to keep the full history and context of how branches combined, or when working with shared branches.
Click to reveal answer
advanced
What is a risk of rebasing shared branches?
Rebasing shared branches can rewrite history others rely on, causing confusion and conflicts.
Click to reveal answer
What does 'git rebase' do to your commits?
ADeletes them permanently
BMoves them to a new base commit
CCreates a merge commit
DPushes them to remote automatically
Which command preserves the exact history of both branches?
Agit merge
Bgit rebase
Cgit reset
Dgit stash
When should you avoid rebasing?
AWhen you want to update your branch
BWhen working on a private branch
CWhen you want a clean history
DWhen your branch is shared with others
What is a benefit of merging?
ACreates a linear history
BAutomatically rebases your branch
CKeeps all branch history intact
DDeletes old commits
Which command would you use to update your feature branch with the latest main branch changes without merge commits?
Agit rebase main
Bgit reset main
Cgit merge main
Dgit stash main
Explain in your own words when you would choose to rebase instead of merge.
Think about how you want your project history to look.
You got /3 concepts.
    Describe the risks of rebasing a branch that others are using.
    Consider what happens if you change something others already have.
    You got /3 concepts.