Git Getting Started!

Git, from the inside out #

Hello and welcome.

This course begins with a very simple observation: if you want to have a job in IT, no matter which one, knowing Git is not optional. Git is used everywhere.

There is no shortage of Git tutorials that hand you six commands and wish you luck. This is not one of them. Here we do something slightly unusual and, I promise, much more useful: every time you type a command, we open the hood and look at what it did. You will create a commit, and then you will go and read the commit — the actual file, in the actual directory, with the actual forty characters of hash. You will discover that a branch is a text file containing one line. You will find your own deleted work still sitting in the object store, waiting for you.

This costs a little more effort in the first hour. It pays for itself roughly forever, because the alternative is memorising incantations and panicking when one of them fails.

ℹ️ The course assumes you can open a terminal and are willing to type in it. It does not assume you know anything about version control, or about systems programming. If a terminal makes you nervous, this gentle introduction is fifteen minutes well spent, and then come back.

How to read this #

Parts 1 and 2 are the course proper, and they are meant to be read in order, with your hands on the keyboard. Everything from Part 3 onward is more of a reference: dip in when you need it.

If you have never used Git at all, start at the beginning and do not skip Inside the repository, inside the commit — it is the chapter the rest of the course leans on.

If you already use Git daily and want the parts you probably do not know: One repository, many working trees, Abusing git notes for fun and profit, and Things inspired by Git.

Table of contents #

Part 1 — Understanding Git #

What Git is, and what actually happens inside .git when you save your work.

  1. What is Git?
  2. Git and its ecosystem
  3. First steps, first Git commands
  4. Let’s save our work!
  5. Inside the repository, inside the commit
  6. We know how to save… but how to modify? to delete ? to cancel?
  7. Playing with our revisions

Part 2 — Collaborating #

Branches, remotes, merges, conflicts, and how to recover when it goes wrong.

  1. Collaborate with Git
  2. Working with remote repositories
  3. Retrieve and send code
  4. A little structure please
  5. Implement an efficient collaborative workflow
  6. Keep a clean history, recover from mistakes

Part 3 — The tooling ecosystem #

The command line, the forges, the GUIs and the editor integrations.

  1. Making the command line yours
  2. Hosting Git, and hosting it yourself
  3. Graphical Git clients
  4. Editors, IDEs and the file browser

Part 4 — Beyond the basics #

Worktrees, agents, notes, large files, data and models — and the ideas Git spawned.

  1. One repository, many working trees
  2. Worktrees and agents, parallel work at machine speed
  3. Abusing git notes for fun and profit
  4. Big files, or how Git meets its limits
  5. Git for data and models
  6. Things inspired by Git

Part 5 — Git as the engine of automation #

GitOps, continuous integration, continuous deployment, and a bag of tricks.

  1. GitOps
  2. Continuous integration with Git
  3. Deploying a simple static site
  4. Continuous deployment
  5. Shining in society and amazing friends with Gitfoo

Part 6 — Appendices #

Installing Git, SSH keys and signing, and setting up a hosting account.

  1. Installing and configuring Git
  2. Configure Git with an SSH key
  3. Create and configure your GitHub or GitLab account

About #

Written by Ori Pekelman. The examples are not decorative: they are regenerated against the installed Git by utilities/scenario.sh, so what you read is what the command actually prints. If you find something wrong, that is a bug — please report it.