Beginner Guide

Your First Steps with Git

Learn Git from zero to your first push in 6 simple steps. Interactive visualizations help you understand what’s happening at each stage.

6Steps
15Minutes
0Prerequisites
πŸ“₯
βš™οΈ
πŸ“
βž•
πŸ’Ύ
πŸš€
1

Install Git

Get Git running on your machine

Option 1: Download Installer (Recommended)

Download the official Git for Windows installer:

Download Git for Windows
or

Option 2: Using winget

winget install --id Git.Git -e --source winget

Verify Installation

After installing, open a terminal and run:

git --version

You should see something like: git version 2.43.0

2

Configure Git

Set up your identity before making commits

Before you start using Git, you need to tell it who you are. This information will be attached to every commit you make.

Set your name and email:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"
πŸ’‘The --global flag applies this setting to all repositories on your machine.

Verify your settings:

git config --list
3

Create Repository

Initialize your first Git project

A Git repository is where Git stores all the history of your project. Let's create one!

Create a new project folder and initialize Git:

mkdir my-project
cd my-project
git init
Output:Initialized empty Git repository in /my-project/.git/
πŸ“This creates a hidden .git folder that stores all version history.
4

Track Changes

Stage files to prepare for a commit

Before saving changes, you need to tell Git which files to include. This is called "staging".

First, create a file:

echo "Hello World" > index.html

Check the status:

git status

Stage the file:

git add index.html

Or stage all changes with: git add .

πŸ“¦Think of staging as putting items in a box before shipping. You decide what goes in!
5

Save Changes

Create a permanent snapshot of your work

A commit is a snapshot of your staged changes. Each commit has a unique ID and a message describing what changed.

Create your first commit:

git commit -m "Add homepage"
Output:[main (root-commit) a1b2c3d] Add homepage
1 file changed, 1 insertion(+)
✍️Write clear commit messages! Good: "Add user login form" Bad: "Fixed stuff"
6

Share Your Work

Push your code to a remote repository

To share your code with others or back it up online, push it to a remote repository like GitHub or GitLab.

1. Create a repository on GitHub, then link it:

git remote add origin https://github.com/username/my-project.git

2. Push your commits:

git push -u origin main
πŸŽ‰Congratulations! Your code is now on GitHub for the world to see!
πŸŽ‰ Congratulations!

You've Learned the Basics

Now that you know the fundamentals, explore more Git features to level up your workflow.