What's the difference between 'git merge' and 'git rebase'? -
what's difference between git merge
, git rebase
?
suppose there 3 commits, a
,b
,c
:
then developer dan created commit d
, , developer ed created commit e
:
obviously, conflict should resolved somehow. this, there 2 ways:
merge:
both commits d
, e
still here, create merge commit m
inherits changes both d
, e
. however, creates diamond shape, many people find confusing.
rebase:
we create commit r
, actual file content identical of merge commit m
above. but, rid of commit e
, never existed (denoted dots - vanishing line). because of obliteration, e
should local developer ed , should have never been pushed other repository. advantage of rebase diamond shape avoided, , history stays nice straight line - developers love that!
Comments
Post a Comment