Simple Git

Version control with Git, from your first commit to GitHub, pull requests, rebasing, team workflows and how Git stores your work. Every command runs in a sandbox in the page, with the commit graph drawn as you go; the GitHub lessons show real, dated screenshots; and every lesson shows how to undo what it taught.

Each lesson lists its sources: the Git documentation for every command it uses, and the hosting site’s own documentation for its features. See all sources.

Last updated

GThe capstone: Kusina: Lola Remy’s recipe notebook as a shared repository, built with a cousin through branches, pull requests and a release, and your first contribution to someone else’s project.

Stage 1: First steps

Save your work as a history of commits, and understand the three areas every change passes through.

  1. 1.1Why version control Open
  2. 1.2Just enough terminal Open
  3. 1.3Installing and setting up Open
  4. 1.4Your first repository Open
  5. 1.5The staging area Open
  6. 1.6Ignoring files Open
  7. 1.7Good commits and messages Open
  8. 1.PKusina: the first recipes Open

Stage 2: Looking back and undoing

Read history confidently, and know which undo to reach for, down to finding commits you thought were lost.

  1. 2.1Reading history Open
  2. 2.2Comparing versions Open
  3. 2.3Undoing changes you haven’t committed Open
  4. 2.4Fixing the last commit Open
  5. 2.5Undoing commits Open
  6. 2.6Putting work aside Open
  7. 2.7The safety net: reflog Open

Stage 3: Branches

Work on several things at once and bring them together, conflicts included.

  1. 3.1What a branch is Open
  2. 3.2Making and switching Open
  3. 3.3Merging Open
  4. 3.4Merge conflicts Open
  5. 3.5Detached HEAD and old versions Open
  6. 3.6Tags Open
  7. 3.PKusina: a dessert section Open

Stage 4: Your repository on GitHub

Find your way around GitHub, make and edit a repository in the browser, and keep the copy on your computer in step with the one on GitHub.

  1. 4.1GitHub, and a tour of a repository Open
  2. 4.2Creating a repository Open
  3. 4.3Uploading files Open
  4. 4.4Editing and branching in the browser Open
  5. 4.5Remotes and cloning Open
  6. 4.6Fetch, pull and push Open
  7. 4.7When push is rejected Open
  8. 4.8Signing in and pushing to GitHub Open
  9. 4.PKusina on GitHub Open

Stage 5: Working together on GitHub

Give people the right access, change things through reviewed pull requests, merge them, and contribute to a project you don’t own.

  1. 5.1Collaborators and permissions Open
  2. 5.2Pull requests Open
  3. 5.3Reviewing on GitHub Open
  4. 5.4Merging on GitHub Open
  5. 5.5Forks and contributing Open
  6. 5.6Issues and project boards Open
  7. 5.PKusina: Carla joins Open

Stage 6: Rewriting history

Tidy history before sharing it, and know the one rule that keeps rewriting safe.

  1. 6.1Why history is worth tidying Open
  2. 6.2Rebase Open
  3. 6.3The golden rule Open
  4. 6.4Interactive rebase Open
  5. 6.5Merge or rebase? Open
  6. 6.6Cherry-pick Open

Stage 7: Team workflows

See how real teams organise branches, commits and checks, and fix the common team-sized mistakes.

  1. 7.1Branching models Open
  2. 7.2Commit conventions Open
  3. 7.3Hooks and checks Open
  4. 7.4Protecting branches Open
  5. 7.5Large and binary files Open
  6. 7.6A secret got committed Open

Stage 8: How Git works

Understand Git’s model well enough that new commands make sense, then use the tools that search history.

  1. 8.1Objects Open
  2. 8.2Hashes Open
  3. 8.3Refs, HEAD and the index Open
  4. 8.4Finding the commit that broke it Open
  5. 8.5Who changed this, and why Open
  6. 8.6Worktrees and submodules Open

Capstone

On your own computer, build Kusina with a cousin from two clones, release it, recover from three disasters, and make your first contribution.

  1. C.1Set up Open
  2. C.2Lola Remy’s notebook Open
  3. C.3Two cooks Open
  4. C.4Tidy and release Open
  5. C.5Things go wrong Open
  6. C.6Your first contribution Open