learngit
Before you start
Skip to levels

The vocabulary

What a commit actually is

A commit is a snapshot of your project at one moment, with a message saying what changed. Git does not snapshot everything automatically. You choose what goes in. That choosing happens in the staging area, and it is the single idea that makes the rest of Git make sense.

01Your files
Working treeThe folder you actually edit. Git watches it but records nothing on its own.A file here stays untracked or modified until you decide it belongs in the next snapshot.touch notes.md
02The waiting room
Staging areaA list of the exact changes that will go into your next commit.This is why Git feels indirect at first: staging lets you commit some changes and leave others behind.git add notes.md
03Permanent record
HistoryA chain of commits, each one a snapshot plus a message and an author.Commits are what you can return to, compare, share, and branch from.git commit -m "add notes"

The commands you will use first

Four commands cover the whole of chapter 1. Everything later in the course is a variation on moving a change between the three places above.

git statusLook around

Shows which files changed and which are staged. Run it whenever you are unsure what Git is about to record.

git add <file>Stage

Copies the current state of a file into the staging area. Edit it again after staging and you will need to add it again.

git commit -m "message"Record

Turns everything staged into one commit. The message is how you and everyone else will recognise this change later.

git log --onelineRead history

Lists commits newest first, one per line, with the short hash you can use to refer back to them.

That is the whole model.

Now do it once yourself: create a file, stage it, commit it. The graph updates as you type, and nothing here can touch a real repository.

Start level 1.1