0/1

Lesson03

beginner

Initialize a Repository

Goal

Turn an ordinary folder into a Git repository.

This project folder already has a README.md, but Git is not tracking it yet. Git only starts watching a folder once you initialize a repository in it.

Objectives

0/1
  1. Initialize a Git repository in this folder. (Current objective)

Your task nowStep 1 of 1

Initialize a Git repository in this folder.

Need help?

Reference

Before and after

$ git init

Initialized empty Git repository in ~/project/.git/

git init creates a hidden .git folder. That folder is the repository: it holds every commit, branch and setting. Your own files stay exactly where they are.

What changes on disk

project/                     project/
└── README.md      ──▶       ├── .git/        ← new: Git's database
                             └── README.md
Delete .git and the folder is an ordinary folder again, with no history.

Preparing your workspace…

Repository Graph

Click a commit to inspect it

0 commits

Working Tree

Not a Git repository yet

No unstaged changes

Your working tree matches the staging area.

Staging Area

Files prepared for the next commit

No staged changes

Use git add to prepare files for your next commit.

Repository

Committed history

No commits yet

Use git commit to record staged changes.