Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, How Git Works! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript". get the zine!
read the transcript!

when pushing/pulling, the hardest problems are caused by diverged branches

! [rejected]
main -> main
(non fast-forward

fatal: Not possible to fastforward, aborting

fatal: Need to specify how to reconcile divergent branches.

(each of these three messages is in a spiky bubble, and they are all surrounded by numerous sad faces.)

what are diverged branches?

both sides have commits that the other doesn’t, like this:

An illustration of two boxes in a row, connected by a line. The first one has a star, the second has a heart. Branching out from the heart are a box with a hash symbol, labelled “local main”, and a box with a squiggle, labelled “remote main”.

I like to fix my diverged branches before making more commits.

there are 4 possibilities with a remote branch

  1. up to date
    Illustration of three boxes in a row, connected by lines. The final box is labelled both “local” and “remote”.

  2. need to pull
    Illustration of four boxes in a row, connected by lines. The second box is labelled “local” and the fourth one is labelled “remote”.

  3. need to push
    Illustration of four boxes in a row, connected by lines. The second box is labelled “remote” and the fourth one is labelled “local”.

  4. DIVERGED (need to decide how to solve it)
    Illustration of two boxes in a row, connected by lines. Diverging from the second box are two branches. One has one box in it and is labelled “remote”. The other one has two boxes and is labelled “local”.

Illustration of a smiling stick figure with short curly hair.

person: when I have a diverged branch, I usually just run git pull --rebase and move on. On the next page we’ll talk about some other options though!

how to tell if 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)

git fetch and git pull

git fetch just fetches the latest commits from the remote branch.

git pull origin main has 2 parts:

  • run git fetch origin main
  • run git merge origin/main (or sometimes rebase)

(More about how to tell git pull to merge/rebase on page 16!)

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2025 | All rights reserved (see the FAQ for notes about licensing)