Module 2 · Git: the 20 everyday commands · Lesson 9 of 16

What Git is: save points, three areas, init and status

Why Git exists, the three places your changes live, and your first repository.

In this lesson · about 16 minutes

  • Explain what Git does in everyday words
  • Name the working folder, the staging area and the repository
  • Start a repository with git init and read git status

A folder that Git looks after is called a repository (repo). Git keeps its records in a hidden .git folder inside it. GitHub, GitLab and similar websites are places to keep a copy of a repository online so a team can share it; that online copy is called a remote.

The three areas

  1. Working folder: the files you see and edit.
  2. Staging area: a "ready" tray. You choose which changes go into the next save point with git add.
  3. Repository: the save points themselves, created with git commit.

Why the middle step? Because you often change five things but want to save them as two separate, well-described commits. Staging lets you pick.

Whiteboard · watch and try

How a change travels through Git

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Key terms

Say the meaning to yourself, then tap a card to check.

Practice terminal · missions

Start tracking Sam's website

Sam has a website folder but no history yet. The right-hand picture shows Git's three areas once there is a repository.

Missions 0 of 4

  1. 1Move into the website folder.
  2. 2Ask Git for the status.
  3. 3Turn this folder into a repository.
  4. 4Ask for the status again.
sam@practice-box:~

Type a command and press Enter. Try help to list commands. Tab finishes names, ↑ repeats.

No Git repository here yet.

You are in ~. Git pictures appear once you cd into a project that is a repository, or run git init or git clone.

  • ~ (/home/sam)you are here
  • documents
  • notes.txt
  • website
  • index.html
  • README.md
  • style.css

Check your understanding0 of 4 correct

Question 1

1.What is a commit?

Question 2

2.Put the areas in the order a change travels:

Question 3

3.Which command turns a normal folder into a Git repository?

Question 4

4.You are not sure what state your project is in. What do you run?

Quiz score: 0 of 4

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. The practice terminal is a simulation that runs in your browser: it imitates Linux (Ubuntu-style output) and Git closely, but it is not a real computer, and real output can differ slightly. The servers, people, web addresses and GitHub addresses in the labs are made up. Linux is a trademark of Linus Torvalds; Git and GitHub belong to their owners. Read-aloud uses your device's built-in voices.