Git and GitHub, step by step

A beginner’s tutorial in eleven short lessons. Learn to keep the history of your work with Git, share it on GitHub, and publish your own web page. On Windows, macOS or Linux; no experience needed.

11 lessonsabout 6 hoursWindows · macOS · LinuxEN · 中文
Start with Lesson 1 →

Who this is for

Anyone who has never used Git: students, researchers, writers, designers, and programmers who have so far got by without it. You do not need to be able to program, and you do not need to have used a terminal before. If you can type and follow instructions, you can do this.

What you will be able to do

All along you build one small project, a personal web page, and at the end it is online at your own address.

The lessons

Do them in order: each lesson starts where the last one ended. Each takes 15 to 45 minutes.

Lesson 115 min
What are Git and GitHub?
What Git does, what GitHub adds, the handful of words you will meet, and what you will have built by the end of this series. No commands yet.
Lesson 245 min
Install and set up
Make a GitHub account, install VS Code and Git, open a terminal, and tell Git who you are. You do this once on each computer.
Lesson 340 min
Your first repository
Make a folder for your project, turn it into a Git repository, write a small web page and save your first snapshot of it.
Lesson 440 min
Saving changes and looking back
Change your page, see exactly what changed, save more snapshots, look back at old ones, and throw away a change you do not want.
Lesson 540 min
Branches: try ideas safely
Try a new look for your page on a branch, switch between versions in a second, then bring the change into your main line.
Lesson 630 min
Merge conflicts, calmly
Make a merge conflict on purpose, read what Git is asking you, resolve it in VS Code, and finish the merge.
Lesson 740 min
Put your project on GitHub
Create an empty repository on GitHub, connect your project to it, sign in, and push your commits, so your work is safe online.
Lesson 815 min
Publish your page with GitHub Pages
Turn on GitHub Pages and your web page is on the internet, at your own address. Then update it with a push.
Lesson 940 min
Working from two places: pull, push, clone
Bring changes from GitHub to your computer, deal with a push that GitHub refuses, and make a second copy of your project with git clone.
Lesson 1040 min
Pull requests
Propose a change on a branch, review it on GitHub, merge it there, and tidy up. Then see how the same steps let you work with other people.
Lesson 1140 min
Undo and fix mistakes
The commands that get you out of trouble, as recipes. Try each one on your project, so you know what to do when it happens for real.

How to use these lessons

Start with Lesson 1: it explains how the lessons work. You need no experience. Lesson 2 shows you how to install everything, and how to open a terminal, the window where you type commands.

When you are stuck

Where to go next