Your First Repository

Create a project folder, run git init, and see exactly what changes on disk. Git is just files — not magic.

Your recipe collection needs a real home. This lab creates a project folder and runs git init inside it — then, instead of taking git's word for what just happened, opens the real .git directory it created and looks directly at HEAD, objects, and refs.\n\nThis is the single most important intuition to build early: a git repository is genuinely just an ordinary directory full of ordinary files, sitting on the same disk as everything else. Nothing about it is magic, remote, or hidden from you.

What git init Actually Does

mkdir recipes && cd recipes
git init

Nothing about your files changes. git init creates exactly one thing: a .git subdirectory, right there next to your files, containing everything git needs to track this project from now on.

Opening .git Directly

ls .git
HEAD  branches  config  description  hooks  info  objects  refs

Each of these is real and inspectable:

Nothing Is Committed Yet

A fresh repository has no history at all — git init does not create a commit, does not touch your files, and does not require a name or email to run. It only prepares the empty scaffolding that later commands (add, commit) will fill in.

git init

Creates a new, empty .git directory in the current folder, turning it into a git repository. It touches nothing else — no commit is created, and no existing files are modified.

HEAD

A plain text file inside .git that points at whichever branch (or, later, commit) is currently checked out. Confirmed directly in this lab: cat .git/HEAD genuinely shows "ref: refs/heads/master" in a brand-new repository.

📁 Create the Project and Initialize It

Create a folder for your recipe collection and turn it into a real git repository.

mkdir ~/recipes && cd ~/recipes && git init

student@lab:~$ mkdir ~/recipes && cd ~/recipes && git init hint: Using 'master' as the name for the initial branch. This default branch name hint: is subject to change. To configure the initial branch name to use in all hint: of your new repositories, which will suppress this warning, call: hint: hint: git config --global init.defaultBranch <name> hint: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and hint: 'development'. The just-created branch can be renamed via this command: hint: hint: git branch -m <name> Initialized empty Git repository in /home/student/recipes/.git/

👀 Look at the Folder From Outside

List the project folder's contents and confirm the only thing git init actually added is .git itself.

cd ~/recipes && ls -la

student@lab:~$ cd ~/recipes && ls -la total 12 drwxr-xr-x 3 root root 4096 Aug 24 19:31 . drwx------ 3 root root 4096 Aug 24 19:31 .. drwxr-xr-x 7 root root 4096 Aug 24 19:31 .git

🔬 Open .git and See What's Inside

List the contents of .git itself — the real files git init genuinely created.

cd ~/recipes && ls .git

student@lab:~$ cd ~/recipes && ls .git HEAD branches config description hooks info objects refs

🧭 Read HEAD Directly

HEAD is a plain text file. Read it directly, and confirm the objects directory is still empty since nothing has been committed yet.

cd ~/recipes && cat .git/HEAD
cd ~/recipes && ls .git/objects

student@lab:~$ cd ~/recipes && cat .git/HEAD ref: refs/heads/master student@lab:~$ cd ~/recipes && ls .git/objects info pack

Lab 1.1.2 complete. A real repository, genuinely inspected from the inside:\n\n\n Repository created : ✅ /home/student/recipes/.git, confirmed on disk\n Folder contents : ✅ only .git was added\n .git structure : ✅ HEAD, objects, refs seen directly\n HEAD content : ✅ read as plain text\n

Enable JavaScript to run the live terminal and track your progress.