![A stick figure smiling](/images/welcome.jpg)
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".](/images/uploads/sha-same-code.png)
read the transcript!
Let’s start with some fundamentals! If you understand the basics about how git works, it’s WAY easier to fix mistakes. So let’s explain what a git commit is!
Every git commit has an id like 3f29abcd233fa, also called a SHA (“Secure Hash Algorithm”).
A SHA refers to both:
- the changes that were made in that commit (see them with git show
)
- a snapshot of the code after that commit was made
No matter how many weird things you do with git, checking out a SHA will always give you the exact same code. It’s like saving your game so that you can go back if you die You can check out a commit like this:
git checkout 3f29abk
SHAS are long but you can just use the first 6 chars
This makes it way easier to recover from mistakes!
person at 10 am: ok, let’s commit, that’s a2992b
person at 11 am: I really screwed up this file, let’s go back to the version from a2992b
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!