Creating Your First Repository
git init, git status, working directory, staging area, repository, .git folder
Creating Your First Repository
A Git repository is a directory that Git tracks. Everything inside it — files, folders, history — is managed by Git. Creating a repository is the first step in any new project.
Initializing a Repository
Navigate to your project folder in the terminal and run:
mkdir my-project
cd my-project
git initThis creates a hidden .git folder inside your project. That folder contains the entire history and configuration of the repository. Never delete it manually.
The Three Areas of Git
Understanding Git requires knowing its three areas. The working directory is where you edit files. The staging area (also called the index) is where you prepare changes for the next commit. The repository is the permanent history of committed snapshots.
A file moves from the working directory to the staging area with git add, and from the staging area to the repository with git commit.
Checking Repository Status
Run git status at any time to see which files are untracked, modified, or staged. It is one of the most frequently used Git commands and always gives you a clear picture of the current state.
git statusYou will see output showing untracked files in red and staged files in green. This feedback loop is central to the Git workflow.
