git init creates a new Git repository in your current folder by making a hidden .git directory. That directory stores the repository’s metadata, history, and settings, so Git can start tracking files in that project.

What it does

  • Initializes a brand-new repository in an empty folder or an existing project.
  • Creates the .git directory that holds objects, refs, config, and other Git data.
  • Does not automatically add or commit your files; you still need git add and git commit afterward.

Simple example

  1. Go into your project folder.
  2. Run git init.
  3. Add files with git add ..
  4. Save the first snapshot with git commit -m "First commit".

In plain English

Think of git init as telling Git, “Start watching this folder as a project.” After that, Git can track changes, branches, and commits inside it.

TL;DR: git init starts a local Git repo by creating the hidden .git folder, but it doesn’t track files until you stage and commit them.