If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
panel 1: combining different versions of files is core to git
Illustration showing two boxes, each with three symbols, being added together.
(a, b, y) + (x, b, c) = ???
it’s very hard
panel 2: to merge files, you need to know what the original was
picture:
original is (a, b, c)
one side changed a -> x so it’s (x, b, c)
the other side changed c -> y so it’s (a, b, y)
panel 3: git merges by combining all changes
merge machine with everything from panel 1 in a thought bubble:
(a, b, c) (x, b, c) (a, b, y)
result is (x, b, y)
panel 4: if both changed the same line it’s a merge conflict
merge machine with a thought bubble showing:
(a, b, c)
(x, b, c)
(z, b, y)
result is (a/z, b, y)
The result has red question marks around it because the first position has two values in conflict. There are also red sad faces and x’s around the illustration.
panel 5: git figures out the original version by looking at commit history
Illustration showing a path with a starting point labelled “original”, with a note that this is called the “merge base”. Two paths, labelled v1 and v2, diverge from it.
panel 6: cherry-pick
, revert
, rebase
, and merge
all need to combine files
Illustration of a smiling stick figure with curly hair.
person: “they all use the same merge algorithm, using some clever tricks! we’ll talk about that next.”
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!