git init
The Birth of a Repository
Every Git repository starts with a single command. But what does git init actually do? It does not connect to the internet, it does not scan your files, and it does not magically back up your project. It simply creates an empty hidden folder called .git.
The Boilerplate Setup
When you run git init, Git generates a boilerplate directory structure inside the .git folder. This folder is the entire brain of your repository.
If you delete the .git folder, your files remain intact, but you lose all your commits, branches, and history. If you copy the .git folder to a flash drive, you have copied the entire repository.
Interactive Explorer
Click through the files and folders that appear immediately after running git init to understand what each one is for.
Proving the Architecture
Let's create a brand new directory, run git init, and use the tree command to see exactly what Git just built.