Initialize a repository
`git init` turns any folder into a Git repository. A hidden `.git/` directory appears — that's where the entire history lives.
To start tracking a folder with Git, you run git init inside it. Git creates a hidden .git/ directory at the root — that's your repository. Everything Git knows about your project lives in there.
Don't delete .git/. If you do, you lose all the history. The rest of the folder (your actual files) is called the working tree — what you see and edit.
Two ways to start a repo: git init for a brand-new project on your machine, or git clone <url> to download an existing repo from GitHub or elsewhere. clone does the init for you and pulls down all the history.
First setup: tell Git who you are. git config --global user.name 'Ton Nom' and git config --global user.email 'toi@email.com'. Git uses these in every commit signature. The --global flag means the config applies to all your repos.
After git init, your folder has no commits yet — it's a blank repository. Git is ready to track changes, but nothing has been recorded. The next steps (add + commit) put your first snapshot in the history.
Practice
Type the command to turn the current folder into a new Git repository.
Practice
Type the command to download an existing repo from `https://github.com/user/repo.git`.
Practice
Set your global Git identity:
git config user.name "Ton Nom" / git config --global user.email
Grounded on https://git-scm.com/docs/git-init
Next up
The three trees: working, staging, repository
Git has three areas: the files you edit (working tree), the changes you've prepared (staging), and the committed history (repository). Every Git command moves data between these.