A Git repository is a project folder that Git is tracking. Until you initialize one, Git ignores your files completely. The command to start tracking is git init.

Create a Practice Project

Let's make a small folder to experiment with. In your terminal:

# Go to wherever you keep coding projects
cd ~/Documents

# Create a new folder and move into it
mkdir my-git-practice
cd my-git-practice

Now create a simple HTML file — something you already know how to write:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>My Git Practice Site</title>
  </head>
  <body>
    <h1>Hello, Git!</h1>
    <p>This is my first version-controlled project.</p>
  </body>
</html>

Save that as index.html inside my-git-practice.

Initialize the Repository

From inside my-git-practice, run:

git init

Git responds with something like:

Initialized empty Git repository in /Users/you/Documents/my-git-practice/.git/

Your folder is now a repo. Nothing is committed yet — Git is just watching.

The Hidden .git Folder

Run:

ls -a

You'll see a folder called .git. That's where Git stores all its history, configuration, and metadata. Never delete or manually edit .git unless you want to destroy the repository.

Normal tools hide dotfiles by default. In VS Code's file explorer you may need to enable "Show Hidden Files" to see it — but you rarely need to look inside.

What git init Does Not Do

  • It does not automatically save your files.
  • It does not upload anything to the internet.
  • It does not track files until you explicitly add them.

git init only says: "Start watching this folder." The next lessons cover how Git tracks changes and how you save snapshots.

One Repo Per Project

Convention: one Git repository per project. Your blog from the HTML lessons would be its own repo. A separate CSS exercise would be another. Don't run git init in your home directory or Documents folder — only inside the specific project folder you want to track.