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!
read the transcript!
A branch in git is a pointer to a commit SHA
master → 2e9fab awesome-feature → 3bafea fix-typo → 9a9a9a
Here’s some proof! In your favourite git repo, run this command:
$ cat .git/refs/heads/master
“master” is just a text file with the commit SHA master points at!
Understanding what a branch is will make it WAY EASIER to fix your branches when they’re broken: you just need to figure out how to get your branch to point at the right commit again!
3 main ways to change the commit a branch points to:
- git commit
will point the branch at the new commit
- git pull
will point the branch at the same commit as the remote branch
- git reset COMM T_SHA
will point the branch at COMM T_SHA
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!