Lesson 4 / 28

git init

Turn any folder into a repository with git init, which creates the hidden .git directory.

Start tracking a folder

git init creates a hidden .git folder here — that's what makes this a repository.

mkdir my-project && cd my-project
git init

Output:

Initialized empty Git repository in /my-project/.git/

One repo, one root

Run git init once at the project root — nested .git folders inside subfolders will confuse Git, not help it.