ILILCode
HomeGitFoundations

Git in one picture (and what GitHub is not)

Three places your work lives, one command to see them, and a clean line between Git and GitHub.

Lesson 1 of 9 in Git7 min1 exercise

Git is a version control system. It records snapshots of a project so you can see what changed, go back, and work on more than one idea without copying folders. It runs on your computer and needs no internet.

Three places your work lives

  • Working directory — the files you actually edit.
  • Staging area — the changes you have chosen for the next snapshot.
  • Repository — the hidden .git folder where commits are stored.
The loop you will repeat forever
# what changed?
git status

# choose changes for the next snapshot
git add notes.txt

# record the snapshot with a message
git commit -m "Add notes"

A commit is a snapshot plus a message, a hash and a pointer to its parent. A branch is just a movable pointer to a commit, and HEAD is the pointer you are standing on. That is most of the model.

Exercises

Checked in your browser · hints and solutions included

01

Exercise

Ask Git what changed

You are inside a Git repository and want to see which files are modified, staged or untracked. Type the command.

terminal