Skip to Content
Navigation:

A stick figure smiling

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".

browse more comics! get the zine!
read the transcript!

branches have very few rules

git lets you move branches forwards, backwards, or sideways if you want

Illustration of three circles in a vertical line, with an additional branch extending out of the middle circle. The top circle is labelled “main”. The middle circle is labelled “You could move main here. The circle in its own branch is labelled “or here.”

all changes to a branch are recorded in its reflog

You can look at the reflog like this:

git reflog BRANCHNAME

reflog stands for “reference log”

when you delete a branch, its reflog is deleted

Illustration of a sad stick figure with short curly hair, talking to a box with a smiley face representing git.

person: what if I wanted to look at the history of that branch to recover something?

git: too bad!

git will eventually delete any commit that isn’t on a branch/tag/etc

Illustration of four circles in a vertical line. The top one is labelled “main”. There is a branch coming off of the second-from-bottom circle, and it is labelled “will be deleted by garbage collection after ~90 days unless you put it on a branch.”

git branch -d won’t let you delete unmerged branches

Illustration of three circles in a vertical line. The top one is labelled “main”. There is a branch coming off of the bottom circle, labelled “my branch (not merged)”

to delete an unmerged branch, you need to force it with -D

rules git doesn’t have about branches

  • when you push/pull a branch, the name doesn’t have to match
  • the main branch doesn’t have any special protections in git itself (though tools like GitHub can protect it)

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 2024 | All rights reserved (see the FAQ for notes about licensing)