t0ul

Introducing Git and GitHub the Safe Way

Most git tutorials teach you to type the commands. This one teaches you the commands and the four habits that the commands alone do not give you. It is for people who have just started to code, or who have been coding for years and still feel that git is a thing that happens to them.

The four promises

By the end of nine short chapters you will be able to keep these, on your own projects and on anyone else’s:

  1. No secret ever lands in a repository. Not a password, not an API key, not the customer list. And if one does, you know what to do in the first ten minutes.
  2. No work is ever lost. Every mistake git lets you make has an undo, and you know which one to reach for.
  3. Nothing changes on main by surprise. Every change arrives through a pull request that someone has read, even when that someone is you.
  4. Nobody acts as you. Your account, your keys and your tokens are set up so that a leaked password is an inconvenience, not a disaster.

“Safe” here is not about paranoia. It is the difference between a repository you can hand to a colleague, an employer or a stranger on the internet, and one you quietly hope nobody looks at too closely.

Who it is for

You can open a terminal, you have git installed, and you have a GitHub account. If any of those is not true yet, Part 0 of Automate the Boring Stuff with Go gets you there in an afternoon, and its chapters 0.3 and 0.4 are the gentle version of this book’s first three. You do not need to know Go or any particular language; the examples are text files and a recipe.

What you need

A computer running Windows, macOS or Linux, git, and a GitHub account. Chapter 4 installs one small scanner. Everything on the GitHub side is in the free plan for public repositories; where a feature needs a paid plan or a private repository, the chapter says so.

The book has a practice repository, github.com/t0ul/git-and-github-the-safe-way, set up exactly the way the chapters describe: the hook, the check, the code owners file, a protected main, and a recipe to practise on. Chapter 5 has you fork it and send it a pull request; chapters 6 and 7 use it as the worked example. Every GitHub screen in this book was exercised on that repository while writing.

Contents

How to read it

In order, at a keyboard, with a throwaway repository open. Every command in the book was run while writing it, and every output you see is what the command printed; where a chapter clicks through GitHub’s settings, the button names come from GitHub’s own documentation on the day of writing, with a link so you can check when they move again. The whole thing is a weekend, and chapters 1 to 3 are an evening.

Start with Chapter 1. Snapshots, not sync.

← Back to the blog