0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
"Rebase vs Merge" is one of the most hotly debated topics in the Git world. A lot of the discussions you'll see online come down to the fact that many developers (yes, even professionals) don't understand the purpose of rebase and use it incorrectly, causing a bunch of Git havoc, and then blame the rebase command.
It's not Git's fault, it's a skill issue.
Say we have this commit history:
A - B - C main
\
D - E feature_branch
We're working on feature_branch
, and want to bring in the changes our team added to main
so we're not working with a stale branch. We could merge main
into feature_branch
, but that would create an additional merge commit. Rebase avoids a merge commit by replaying the commits from feature_branch
on top of main
. After a rebase, the history will look like this:
A - B - C main
\
D - E feature_branch
Both rebase and merge can be used to integrate changes from one branch into another.