Git is the most widely used version control system in the world, and it’s essential for developers and teams working collaboratively on code. If you’re using Windows and want to get started with Git, this guide walks you through the entire process—from installation to basic commands.
🧰 Prerequisites
Before using Git, make sure you have:
- A Windows machine (Windows 10 or 11 recommended)
- Administrator access to install software
✅ Step 1: Install Git for Windows
- Go to the official Git website:
👉 https://git-scm.com/downloads - Click “Download for Windows”.
- Run the installer and follow the steps:
- Choose Git Bash as your terminal emulator (recommended)
- Use default options unless you have specific preferences
- Enable Git from the command line and also from 3rd-party software
- After installation, verify Git by opening Command Prompt or Git Bash and running:
git --version
✅ Step 2: Configure Git
Set your name and email (used in commits):
git config --global user.name "Your Name"
git config --global user.email "yo******@ex*****.com"
View configuration at any time:
git config --list
✅ Step 3: Create or Clone a Repository
Create a new Git repository:
- Open a terminal or Git Bash.
- Navigate to your project folder:
cd path/to/your/project
- Initialize Git:
git init
OR Clone an existing repo from GitHub:
git clone https://github.com/username/repo-name.git
✅ Step 4: Common Git Commands
Here are some essential Git commands to get you started:
Task | Command |
---|---|
Check status | git status |
Add files to staging | git add filename or git add . |
Commit changes | git commit -m "Your commit message" |
View commit history | git log |
Add remote repository | git remote add origin <repo-URL> |
Push to remote repo | git push -u origin main |
Pull latest changes | git pull origin main |
✅ Step 5: Use Git in Visual Studio Code (Optional)
If you’re using Visual Studio Code:
- Open your project folder
- Go to the Source Control tab (or press
Ctrl+Shift+G
) - Click “Initialize Repository” or start using Git right away if it’s already initialized
✅ Step 6: .gitignore and Best Practices
- Create a
.gitignore
file to exclude files and folders from tracking (e.g., logs,.env
,node_modules
) - Always commit with meaningful messages
- Avoid committing large binary files or sensitive data
📝 Summary
Task | Tool / Command |
---|---|
Install Git | git-scm.com |
Configure Git | git config --global |
Initialize repo | git init |
Clone repo | git clone <url> |
Add & commit changes | git add , git commit |
Push & pull from GitHub | git push , git pull |
Getting started with Git on Windows is simple and powerful. Once installed and configured, you can manage version control for all your development projects with just a few commands.