If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
panel 1: you can see for yourself how git is storing your files!
You just need one command: git cat-file -p
First, get a commit ID. You can get one from git log
panel 2: read the commit
$ git cat-file -p 3530a4
tree 22b920
parent 56cfdc
author Julia <julia@fake.com> 1697682215 -0500
committer Julia <julia@fake.com> 1697682215 -0500
panel 3: read the directory
$ git cat-file -p 22b920
100644 blob 4fffb2 .gitignore
100644 blob e351d9 404.html
100644 blob cab416 Cargo.toml
100644 blob fe442d hello.html
040000 tree 9de29f src
panel 4: read a file
$ git cat-file -p fe442d
<!DOCTYPE html>
<html lang="en">
<body>
<h1>Hello!</h1>
</body>
</html>
panel 5: and we’re done!
fe442d
is the sha1 hash of the contents of the file. It’s called a “blob id”.
this is how git keeps things efficient: it only needs to make a new copy when the file changes
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)