All labs

Git & GitHub

Type real Git commands into a small café’s website repository and watch what each one moves: files into the staging area, commits onto branches, branches into each other, and your work up to GitHub and back.

Briefing

You've just been handed the repository for a small café's website, and you'll run real Git commands in it. Each one moves something you can watch: a file into staging, a commit onto a branch, a branch into another, your work up to GitHub and back.

You'll learn to

  • Stage, commit and undo changes, and say what a commit really is
  • Branch, merge, and resolve a merge conflict
  • Push to GitHub, pull someone else's work, and open a pull request
  • Pick the right undo — restore, revert or reset — in public and in private
0 of 13 steps done0%
Start: Your first save point
Git Essentials: The Everyday CommandsOptional warm-upThe staging area, what a branch really is, merge conflicts, and revert versus reset. About ten minutes.
  1. Only what’s ready

    Why the staging area exists

  2. Take it back

    restore, and undoing staged changes

  3. What a commit really is

    Snapshots, parents, labels

  4. A branch is a label

    branch, switch, and a safe place to try things

  5. Bring it home

    merge, the simple case

  6. When both moved on

    The merge commit

  7. Merge conflict

    When two people change the same line

  8. Your repository and GitHub’s

    Remotes, push, pull, clone

  9. Put it on GitHub

    remote add, push -u

  10. Someone pushed first

    Rejected pushes, and pull

  11. Pull requests

    clone, branch, push, review, merge

  12. Undo in public

    revert, versus rewriting history