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.
Install Git
Get Git running on your machine
Option 1: Download Installer (Recommended)
Download the official Git for Windows installer:
Download Git for WindowsOption 2: Using winget
winget install --id Git.Git -e --source wingetVerify Installation
After installing, open a terminal and run:
git --versionYou should see something like: git version 2.43.0
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"--global flag applies this setting to all repositories on your machine.Verify your settings:
git config --listCreate 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-projectcd my-projectgit initInitialized empty Git repository in /my-project/.git/.git folder that stores all version history.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.htmlCheck the status:
git statusStage the file:
git add index.htmlOr stage all changes with: git add .
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"[main (root-commit) a1b2c3d] Add homepage
1 file changed, 1 insertion(+)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.git2. Push your commits:
git push -u origin main