If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
when pushing/pulling, the hardest problems are caused by diverged branches
sad error messages:
! [rejected]
main -> main
(non fast-forward
)
fatal: Not possible to fast-forward, aborting
fatal: Need to specify how to reconcile divergent branches.
what are diverged branches
it looks like this:
Diagram with two blank boxes, followed by a box with a heart in it, that then branches out into two branches, one with a hash symbol in it, labelled “local main”, and one with a squiggle in it, labelled “remote main”.
there are 4 possibilities with a remote branch
up to date (with a heart)
Illustration of three boxes in a row, labelled both “local” and “remote”need to pull
Illustration of four boxes in a row. The second box in the sequence is labelled “local”, the fourth branch is labelled “remote”.need to push
Illustration of four boxes in a row. The second box in the sequence is labelled “remote”, the fourth branch is labelled “local”.diverged (need to decide how to solve it) (sad face)
Illustration of two boxes in a row, that then branches out into two branches. One of the branches has one box, labelled “remote”, and the other branch has two boxes, labelled “local”.
how to tell your branches have diverged: git status
$ git fetch
(get the latest remote state first)$ git status
Your branch and ‘origin/main
’ have diverged, and have 1 and 1 different commits each, respectively.
(use “git pull
” to merge the remote branch into yours)
(diverged is highlighted)
fix diverged branches before making more commits
First illustration: two boxes in a row, then branches out into two branches, each with one box. It’s labelled “not so bad to resolve…”
Second illustration: two boxes in a row, then branches out into two branches, but each branch has a whole bunch of boxes.
Illustration of a sad stick figure with curly hair.
person: oh no
there’s no one solution
Illustration of a smiling stick figure with curly hair.
person: on the next page we’ll talk about some options!
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!