Skip to Content

A stick figure smiling

Here's a preview from my zine, Oh Shit! Git!! 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!

Yes! It’s called git reflog and it logs every single thing you do with git so that you can always go back.

Suppose you ran these git commands:

git checkout my-cool-branch (1)
git commit -am "add cool feature" (2)
git rebase master (3)

Here’s what git reflog’s output would look like.
It shows the most recent actions first:

245fc8d HEAD @{2} rebase -i (start): (3) checkout master
b623930 HEAD @{3} commit: (2) add cool feature
01d7933 HEAD @{4} checkout: (1) moving from master to my-cool-branch

If you really regret that rebase and want to go back, here’s how:

git reset --hard b623930
git reset --hard HEAD@{3}
2 ways to refer to that commit before the rebase

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)