Git logo: a red diamond with a branching line
GitHub logo: a black circle with a white cat silhouette called the Octocat

Images: GitHub Explore

Git & GitHub,
from zero.

Save your work, go back in time, and build things with other people.

No coding needed. About 15 minutes.

The problem

Sound familiar?

You save a file. Then you save it again with a new name. And again. Soon you have no idea which one is the real one.

essay.docx
essay_v2.docx
essay_final.docx
essay_FINAL_really.docx

Git fixes this.

With Git you keep one file. Git quietly remembers every version for you, with a note about what changed.

Two names, two jobs

Git is the camera.
GitHub is the photo album.

People mix them up all the time. Here is the simple difference.

Git

A free tool on your computer

Git takes snapshots of your project. Each snapshot remembers exactly how every file looked at that moment. You can go back to any of them.

Like a camera that photographs your work.

GitHub

A website

GitHub keeps your Git projects online. That way you can back them up, share them, and work on them with other people.

Like an online album where everyone can see the photos.

Images: GitHub Explore

Idea 1 of 5

Repository.
Your project folder.

A repository (or "repo") holds all the files of one project. It also keeps the full history of every change ever made.

What is a README?

A README is the welcome sign of your repo. It is a short text file that says what the project is and how to use it. GitHub shows it on the front page of your repo.

The .md ending means Markdown, a simple way to write text with headings and lists.

GitHub menu opened from the plus sign in the top right corner. The first option, New repository, is highlighted. Other options are Import repository, New codespace, New gist and New organization.
To make a repo on GitHub, click the + in the top right corner, then New repository.Image: GitHub Docs

Idea 2 of 5

Commit.
A save point with a note.

When you commit, Git takes a snapshot of your files. You add a short message so you remember what you changed.

  1. Add READMEMon 9:02
  2. Write first paragraphMon 9:40
  3. Fix typo in titleTue 14:15
  4. Add a photoWed 11:30
  5. Update contact infoThu 16:05

Made a mistake? Jump back to any dot. Good messages are short and clear, like "Fix typo in title".

Idea 3 of 5

Branch.
A safe copy to try ideas.

Branch diagram A straight line called main runs left to right. A feature branch splits off below it, gets three commits, has a pull request opened, and then merges back into main. main feature Add my changes?
  1. This is main. It is the official, working version of your project.
  2. Make a branch. It is a copy of main where you can try ideas safely.
  3. Commit on the branch. Your changes stay here. Main is not touched.
  4. Open a pull request. You ask: "Can we add my changes to main?"
  5. Merge. After a review, your changes join main. Done!
GitHub's branching diagram. A feature branch is created from main, gets commits, a pull request is submitted, people discuss the changes, and the feature branch is merged back into main.
The same idea, drawn by GitHub. People can discuss your changes before they join main.Image: GitHub Docs

Idea 4 of 5

Pull request.
"Add my changes?"

A pull request (or "PR") asks the team to look at your branch and add it to main. GitHub shows exactly what changed. This view is called a diff.

A GitHub diff for the file README.md. Three red lines were removed: test-area-2, edit1 and edit2. Three green lines were added: About me, an empty line, and My name is Mona Lisa.
A diff of the README file.Image: GitHub Docs
Red lines were removed.
Green lines were added.

Others can leave comments, ask questions, or suggest fixes before anything changes in main.

Idea 5 of 5

Merge.
Bring it home.

Merging adds the changes from your branch into main. Most of the time it takes two clicks.

Normal merge

On the pull request page, click Merge pull request, then Confirm merge. Try it:

This branch has no conflicts with main

Merge conflict

Ana and Ben changed the same line. Git cannot guess which one is right, so it asks you. It is not an error. It is just a question.

Line 1 of README.md

AnaWelcome to my page
BenHello and welcome

Pick one to fix the conflict.

Put it together

The GitHub flow.

This is how most people work on GitHub. Five steps, again and again.

  1. 1BranchMake a safe copy
  2. 2CommitSave your changes
  3. 3Pull requestAsk to add them
  4. 4ReviewOthers take a look
  5. 5MergeJoin main

Then repeat with a new branch.

For later

Six starter commands.

You can do everything on this page in your browser. But one day you may use Git on your own computer by typing commands. Click one to see what it does.

Pick a command above to try it.

What does it do?

Each command has a plain English meaning. Pick one to find out.

Your turn

Hello World.
Do it for real.

Open github.com in a new tab and sign in (it is free). Follow these five steps. Tick each one when you finish.

0 of 5 done

  1. Click + in the top right corner, then New repository. Name it hello-world. Turn on Add a README file. Click Create repository.

  2. On the Code tab, click the button that says main. Type readme-edits in the box. Click Create branch: readme-edits from 'main'.

    The branch menu on GitHub. The text box says readme-edits, and the option Create branch: readme-edits from main is highlighted.
    Image: GitHub Docs
  3. While on the readme-edits branch, click README.md, then the pencil icon. Write a line about yourself. Click Commit changes, add a short message, and click Commit changes again.

  4. Click the Pull requests tab, then New pull request. Choose readme-edits to compare with main. Check the red and green lines. Click Create pull request, add a title, and click Create pull request again.

  5. At the bottom of your pull request, click Merge pull request, then Confirm merge. You can now delete the branch. Your change is in main!

Read the official Hello World guide

Good to know next

A few more words
you will see.

Issues

A to-do list for your project. Use issues to report bugs, ask questions or plan new ideas.

Fork

Your own copy of someone else's repo. Change it freely, then offer your changes back with a pull request.

GitHub Pages

Free website hosting. Put HTML files in a repo and GitHub turns them into a live website. Like this one!

Two-factor login (2FA)

An extra lock on your account. After your password, you also enter a code from your phone. Turn it on.

Check yourself

Mini quiz.

Five quick questions. No pressure. You get the answer right away.

Look it up

Glossary.

Every word from this page, in one place.

Repository (repo)
A project folder that holds your files and the full history of every change.
Commit
A save point with a short note that says what you changed.
Branch
A safe copy of your project where you can try ideas without changing main.
Main
The default branch. It holds the official, working version of the project.
Pull request (PR)
A request to add the changes from your branch into another branch, usually main. Others can review it first.
Merge
Adding the changes from one branch into another.
Merge conflict
When two people changed the same line. Git asks you to pick what to keep. It is a question, not an error.
Clone
Making a copy of a repo from GitHub on your own computer.
Push
Sending your commits from your computer up to GitHub.
Pull
Bringing the newest changes from GitHub down to your computer.
Fork
Your own copy of someone else's repo on GitHub.
README
A welcome file that explains what a project is and how to use it.
Issue
A note in a repo to report a bug, ask a question or suggest an idea.