Exit course

A 15-minute course

How GitHub works

Follow three friends as they build a story game called Space Llama together, without ever losing anyone's work.

  • Maya
  • Leo
  • Priya

Swipe, drag, or use the arrow keys to turn the page.

Two helpers

Git saves. GitHub shares.

When lots of people build one project, work can get erased and nobody remembers who changed what. Coders use two tools to fix that.

Git

Remembers every version of your project, right on your computer.

GitHub

A website that puts the project online, so the whole team can work on it.

Repository

A repo is the project's home.

It holds every file, plus the history of every change ever made. Tap a file to see what it's for.

maya/space-llamaPublic

  • The cover page. It tells visitors what the project is and how to use it.

  • The words of the story. Git remembers every change to every sentence.

  • Priya's drawing of the llama in her space helmet. Pictures can live in a repo too.

  • The code that makes the game run, like what happens when you press the jump button.

A public repo is like a library book: anyone can read it. A private repo is like a diary: only people you invite can open it.

Commit

A commit is a save point.

Each commit saves a snapshot of the project with a short note about what changed. Add to the story, then tap an older dot to go back in time.

Branch

A branch is a safe place to try ideas.

Leo wants the llama to breathe fire. He tries it on his own branch, so the game everyone else uses can't break.

mainfire-breath

Pull request

A pull request asks, “Can we add this?”

Before Leo's idea joins the main project, a teammate checks it. Green lines are new. Red lines are removed.

Add fire breath

Open

Leo wants to add 2 commits to main

story.txt
The llama could not do anything special.
When the llama sneezes, she breathes blue fire.
Bolt the robot uses it to toast cheese.

    Merge conflict

    Sometimes two changes clash.

    Maya and Leo both changed the same line on their own branches. Git can't guess which one is right, so it asks a person to choose.

    story.txt · line 3Conflict

    Maya's change

    The spaceship is pink.

    Leo's change

    The spaceship is gold.

    Inside the file, Git marks a clash with arrows like <<<<<<< and >>>>>>> so you can find it.

    Rebase

    Rebase moves your work to the front.

    While Leo worked on his branch, Priya added a new commit to main. Rebase lifts Leo's commits and sets them on top of the newest main.

    mainfire-breathPriya's new commit

    Clone and fork

    Clone and fork both make copies.

    Each one gives you your own copy of a repo. The difference is where the copy goes.

    Clone

    Copies a repo onto your computer, so you can work on it there.

    Fork

    Copies someone else's repo into your own GitHub account.

    After you fork a project, you can still send your best ideas back to the original with a pull request.

    Push and pull

    Push sends up. Pull brings down.

    Maya cloned the repo, so she works on her own copy and trades updates with GitHub. Help her get both copies to match.

    Maya's laptop

      GitHub

        Quiz

        Word bank

        Words coders use every day.

        You learned the big ones. Here they are with a few more you'll hear, all in one place.

        Saving your work

        Commit
        A save point with a short note about what changed.
        Diff
        Shows exactly what changed. Green lines are new, red lines are removed.
        HEAD
        A "you are here" pin that marks the commit you're looking at.
        Stash
        Puts unfinished changes in a drawer so you can come back to them later.
        Tag
        A name sticker on an important commit, like "Version 1.0."

        Working together

        Branch
        A safe copy where you can try a new idea.
        Merge
        Joining a branch's changes back into main.
        Merge conflict
        Two people changed the same line, so a person has to pick what stays.
        Rebase
        Moving your commits on top of the newest main, so history is one straight line.
        Fast-forward
        A merge where main has nothing new, so Git just slides main up to your newest commit.
        Squash
        Squeezing lots of small commits into one tidy commit, like stapling your rough drafts into one final page.
        Cherry-pick
        Copying just one commit from another branch, like picking one cherry from a bowl.
        Pull request
        Asking your team to check your changes and add them.
        Code review
        Teammates reading your changes and giving feedback before they're added.

        Sharing copies

        Repository
        The project's home. It holds every file and its whole history.
        Clone
        Copying a repo onto your computer.
        Fork
        Copying someone else's repo into your own GitHub account.
        Push
        Sending your commits up to GitHub.
        Pull
        Bringing your team's new commits down to your computer.
        Fetch
        Checking GitHub for new commits without mixing them into your work yet.
        Remote
        The copy of your repo that lives on GitHub. Its usual nickname is "origin."
        Prune
        Cleaning out old branches that were already deleted on GitHub, like trimming dead branches off a tree.

        On GitHub

        Issue
        A to-do note or bug report, like "The llama falls through the floor."
        Star
        A bookmark that also tells the team "I like this project."
        README
        The cover page that explains what a project is.
        .gitignore
        A list of files Git should skip, like giant videos or secret passwords.
        Release
        A finished version that people can download, like Space Llama 1.0.
        Actions
        Robot helpers that do jobs on their own, like testing the game every time someone pushes.