CH.06 · 10 MIN · PART 2

Make a folder Git can see.

A repository is a normal folder with a hidden notebook. Make one, create a file, and watch Git notice it.

git initgit status3 areas
A project folder with a hidden .git history notebook.gitHISTORYhello.txtgit init

What is a repository?

three words
1

A folder

Your normal project folder with your normal files.

2

Plus a hidden .git

git init adds a hidden folder. That is Git's notebook.

3

= a repository

Often shortened to "repo". Delete .git and it is a plain folder again.

The three areas

watch them move

Git moves your work through three places. The panel next to the terminal below shows them live. In this chapter a file travels from the first area to the second.

Working folder

Where you edit files.

Staging area

A waiting room for what goes in the next snapshot.

History

Saved snapshots (commits). Chapter 7.

When it goes wrong

real messages, plain meaning
fatal: not a git repository (or any of the parent directories): .gitGit is not watching this folderYou are outside a repository. Run pwd, cd into your project folder, or run git init if this is a new project.
On branch main No commits yetNothing is wrongA fresh repository has no snapshots yet. That is normal.
Reinitialized existing Git repositoryYou ran git init twiceHarmless. Git leaves your history alone. Run pwd first so you know which folder you are in.

Practice: your first repo

hands-on

The status command is your best friend. Run it often.

1

Loading

practice terminal · bash-style

Quick check

1 / 3

Pick an answer.
Git, Visually · Parts 1 and 2 · English