Skip to content

Latest commit

 

History

History
29 lines (15 loc) · 877 Bytes

rebase.md

File metadata and controls

29 lines (15 loc) · 877 Bytes

Git pull --rebase

git pull = git fetch + git merge against tracking upstream branch

git pull --rebase = git fetch + git rebase against tracking upstream branch

An easier way to understand the difference is this way:

If you have 3 commits A, B & C.

commits

Then developer X creates a commit D and developer Y creates a commit E.

commits

To resolve this conflict, there are 2 ways:

MERGE:

commits

Both commits D & E are still there but a merge commit M is created containing the changes from D & E.

REBASE:

commits

We create commit R which content is identical to merge commit M, but we get rid of E. Advantage is that diamond shape is avoided and history stays nice in a straight line.