Script Valley
Git and GitHub Complete Course: From Beginner to Advanced
Introduction to Version Control and Git BasicsLesson 1.3

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.

DiagramThe Three Areas of Git

IMAGE PROMPT (replace this block with your generated image):

Flat three-zone horizontal diagram on white background. Title: The Three Areas of Git. Three large rectangular zones side by side connected by bold right-pointing arrows. Zone 1: Working Directory — light gray fill (#f8f8f8). Shows file icons with edit pencil. Label: Where you edit files. Arrow label: git add in #3A5EFF pill. Zone 2: Staging Area (Index) — light #3A5EFF fill (#e8ecff), border #3A5EFF. Shows file icons with checkmark. Label: Files prepared for next commit. Arrow label: git commit in #3A5EFF pill. Zone 3: Repository (.git folder) — solid #3A5EFF fill, white text. Shows stacked commit circles labeled C1 C2 C3. Label: Permanent history snapshots. Below all zones: a reverse arrow spanning Zone 3 back to Zone 1 labeled git checkout (dashed gray). Clean flat icons, white background.

Initializing a Repository

Navigate to your project folder in the terminal and run:

mkdir my-project
cd my-project
git init

This 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 status

You will see output showing untracked files in red and staged files in green. This feedback loop is central to the Git workflow.

Up next

Staging and Committing Changes

Sign in to track progress