Git & GitHub Basics — Beginner Guide Roman Urdu Mein
Git aur GitHub ka complete beginner guide. Installation, commands, branches, pull requests, merge conflicts — sab kuch examples ke saath Roman Urdu mein.
Git & GitHub Basics — Complete Roman Urdu Guide
Git aur GitHub developer ke liye literally oxygen hain. Tumhari coding skills 10/10 hon — agar Git nahi aata to kisi acchi company mein job nahi milegi.
Aur good news: Git basics 2 ghante mein master ho sakte hain. Is post mein hum cover karenge:
- ✅ Git aur GitHub mein difference
- ✅ Installation + first setup
- ✅ Basic commands (init, add, commit, push)
- ✅ Branches kaise banayein aur use karein
- ✅ GitHub repo banake code push karein
- ✅ Pull Requests (PR) ka concept
- ✅ Merge conflicts handle karna
- ✅ Common mistakes — bachna hai!
- ✅ Daily workflow — professional developers kaise kaam karte hain
ℹ️ 📚 Prerequisites
- ✅ Terminal/Command line basics
- ✅ VS Code / Cursor installed
- ✅ Koi bhi project folder (HTML/JS/Python — kuch bhi)
- ❌ Pichla Git experience zaroori nahi
1. Git vs GitHub — Confusion Khatam!
Sab se zyada confusion yahin hota hai:
Git Kya Hai?
Git (Tool)
Version control system — code ki history track karta hai
Git = Local tool jo tumhare computer pe install hota hai.
Kya karta hai?
- File changes track karta hai
- "Versions" create karta hai (commits)
- Undo/redo capability
- Team collaboration possible banata hai
GitHub Kya Hai?
GitHub (Platform)
Cloud platform — Git repositories online host karta hai
GitHub = Online platform (jaise Facebook code ke liye).
Kya karta hai?
- Tumhari Git history online store
- Team collaboration platform
- Code review, issues, project management
- Portfolio for developers
- Free hosting
✅ 🎯 Simple Analogy
Git = Microsoft Word (tool on your computer)
GitHub = Google Docs (online storage + sharing)
Tum local Word mein document banate ho, phir Google Docs pe upload karte ho sharing ke liye. Same with Git/GitHub.
2. Installation + Setup
Step 1: Git Install Karo
Windows:
- Download: git-scm.com
- Installer run karo
- Default settings rakho (next, next, next)
Mac:
brew install gitLinux:
sudo apt install gitVerify Installation:
Terminal mein:
git --versionOutput: git version 2.45.0 (ya newer)
Step 2: First-Time Setup (Identity)
Git ko tumhara naam aur email chahiye (har commit ke saath attach hota hai):
git config --global user.name "Babar Burhan"
git config --global user.email "babar@example.com"Important: Email wo same use karo jo tum GitHub pe use karoge.
Step 3: Default Branch Name
Modern convention: main branch (old: master):
git config --global init.defaultBranch main3. First Git Repository
Chalo practical karte hain.
Step 1: New Project Folder
Terminal mein:
mkdir my-first-project
cd my-first-projectStep 2: Initialize Git
git initOutput: Initialized empty Git repository in /path/.git/
.git folder ban gaya — ye hidden folder hai jo sab tracking karega.
Step 3: First File
hello.txt banao kuch text ke saath:
echo "Hello Git!" > hello.txtStep 4: Check Status
git statusOutput:
On branch main
No commits yet
Untracked files:
hello.txt
"Untracked" = Git ko file dikh raha hai, but track nahi kar raha abhi.
Step 5: Stage File (Add to Tracking)
git add hello.txtYa sab files ek saath:
git add .Step 6: Commit (Save Version)
git commit -m "Add hello.txt with greeting"-m = message flag. Commit message descriptive likho — future self thank karega.
Step 7: Check History
git logOutput:
commit a1b2c3... (HEAD -> main)
Author: Babar Burhan <babar@example.com>
Date: Mon May 11 10:00:00 2026
Add hello.txt with greeting
Tumhara pehla commit ho gaya! 🎉
4. Essential Git Commands
Ye 8 commands 90% Git work cover karte hain:
ℹ️ 🔑 Most Important Commands
| Command | Kya Karta Hai |
|---|---|
git init | New repo banaye |
git status | Current state dikhaye |
git add <file> | File stage kare |
git commit -m "msg" | Save version |
git log | History dekhe |
git diff | Changes dikhaye |
git pull | Remote se latest laye |
git push | Local changes remote pe bheje |
Useful Variations:
git add . # Sab files stage
git commit -am "msg" # add + commit ek saath (tracked files)
git log --oneline # Compact history
git diff HEAD~1 # Last commit se differences5. Branches — Parallel Universes
Branches = code ki alternate versions. Main branch break kiye bina experiment kar sakte ho.
Why Branches?
Real scenario: Tumhe naya feature add karna hai, but production code bhi safe rakhna hai.
main branch: [Stable version] ← users use kar rahe hain
↓
feature branch: [Experimenting] ← tum kaam kar rahe ho
↓
Tested → Merge back to main
Branch Commands:
git branch # Saare branches list
git branch new-feature # New branch create
git checkout new-feature # Switch to branch
git checkout -b another-branch # Create + switch (shortcut)
git branch -d branch-name # Delete branchModern Way (Git 2.23+):
git switch main # Switch to main
git switch -c new-feature # Create + switchPractical Example:
# Main branch pe ho
git status # On branch main
# Naya feature start karo
git switch -c add-login-feature
# Kuch changes karo (file edit karo)
echo "login code" > login.js
# Commit karo
git add login.js
git commit -m "Add login feature"
# Wapas main pe jao
git switch main
# login.js gone hai (main pe nahi tha)
ls # Sirf hello.txt dikhegaTumhara code branch mein safe hai. Jab ready ho, merge kar do main mein.
Merge Branches:
# Pehle main pe jao
git switch main
# Feature branch merge karo
git merge add-login-feature
# Optionally feature branch delete karo
git branch -d add-login-feature6. GitHub — Cloud Pe Code
Step 1: GitHub Account Banao
- github.com pe jao
- Sign Up karo (free)
- Username choose karo (e.g.,
babar-dev) - Same email use karo jo
git configmein use ki thi
Step 2: New Repository Banao
- GitHub homepage pe "+" icon → New Repository
- Repository name:
my-first-project - Public select karo (portfolio ke liye)
- Don't initialize with README (since local mein already hai)
- Create Repository
Step 3: Local Code ko GitHub Se Connect Karo
GitHub commands dikhayega:
# Remote URL add karo
git remote add origin https://github.com/babar-dev/my-first-project.git
# Push karo
git push -u origin mainPehli baar: Authentication maangega:
- Username: GitHub username
- Password: Personal Access Token (next section)
7. Personal Access Token (Modern Auth)
GitHub password authentication band kar di hai. Personal Access Token (PAT) chahiye.
Token Banane Ka Tareeqa:
- GitHub pe login karo
- Profile (right top) → Settings
- Developer settings (bottom left)
- Personal access tokens → Tokens (classic)
- Generate new token (classic)
- Note: "My laptop" type kuch
- Expiration: 90 days
- Scopes: ✅
repo(full repo access) - Generate token
- Token copy karo (sirf ek baar dikhega!)
Ab git push mein password ki jagah ye token use karo.
🔐 SSH Keys (Advanced)
Long-term solution: SSH keys setup karo — phir password/token bar bar maange nahi:
ssh-keygen -t ed25519 -C "babar@example.com"
# GitHub Settings → SSH Keys mein public key add karo8. Daily Workflow — Professional Style
Real-world Git workflow ye hota hai:
# 1. Latest changes pull karo (team kaam ka)
git pull origin main
# 2. New feature ke liye branch banao
git switch -c feature/user-profile
# 3. Code likho, edit karo, test karo
# ... (kaam karo) ...
# 4. Changes stage karo
git add .
# 5. Commit karo (descriptive message)
git commit -m "Add user profile page with avatar upload"
# 6. Branch push karo GitHub pe
git push origin feature/user-profile
# 7. GitHub pe Pull Request create karo (next section)
# 8. PR approve hone ke baad
git switch main
git pull origin main
# 9. Old branch delete karo
git branch -d feature/user-profile9. Pull Requests (PR) — Team Collaboration
Pull Request = "Mera code merge karo main branch mein please" ka formal request.
Workflow:
You: Feature branch banao → code likho → push karo
↓
GitHub pe PR create karo
↓
Team review kare (comments, suggestions)
↓
Approve mile → Merge ho jata hai main mein
PR Create Karna:
- GitHub pe repo open karo
- Banner dikhega: "feature/user-profile had recent pushes — Compare & pull request"
- Create Pull Request click karo
- Title descriptive likho: "Add user profile feature with avatar"
- Description mein details:
- Kya change kiya
- Kyun kiya
- Screenshots (UI changes)
- Testing kaise ki
- Reviewers add karo (team members)
- Create Pull Request
✅ 📝 Good PR Description Template
## What
- Added user profile page
- Added avatar upload functionality
## Why
- Issue #42 — users were asking for profile customization
## Testing
- ✅ Tested locally
- ✅ Verified avatar upload size limit (5MB)
- ✅ Mobile responsive
## Screenshots
[Attach images]
10. Merge Conflicts — Don't Panic!
Merge conflict tab hota hai jab Git samjh nahi pata konsi change rakhe.
Example:
You changed file.txt line 5: "Hello World"
Teammate changed file.txt line 5: "Hi Universe"
Git: "Bhai, dono mein se konsi rakhun?"
Resolution:
git pull origin main # Conflict aayaFile khulne pe Git ye dikhata hai:
<<<<<<< HEAD
Hello World
=======
Hi Universe
>>>>>>> origin/main
Fix Karna:
- File khol karo VS Code mein
- Decide karo konsi rakhni hai (ya dono combine)
- Markers remove karo (
<<<,===,>>>) - File save karo
- Stage + commit:
git add file.txt
git commit -m "Resolve merge conflict in file.txt"
git pushVS Code mein GUI help bhi available hai — colored diff dikhe ga, accept current/incoming buttons.
11. Common Mistakes — Avoid Karein
🚫 ❌ Top Git Mistakes Beginners Karte Hain
- Sensitive data commit karna — .env files, API keys, passwords
- Bara files commit karna — node_modules, .next, build folders
- Generic commit messages — "update", "fix bug", "changes"
- Force push to main —
git push -f— team ka kaam destroy ho sakta hai git pull --forceuse karna — local changes lose- Main branch pe directly commit — always branches use karo
- Old branches accumulate karna — regularly cleanup
.gitignorena use karna — junk files commit ho jate hain- Last minute push — daily push karo, not weekly
.gitignore — Critical File
.gitignore file banao project root mein, ye files ignore karne ke liye:
# Dependencies
node_modules/
.pnp/
# Build outputs
.next/
dist/
build/
# Environment files
.env
.env.local
# IDE
.vscode/
.idea/
# OS files
.DS_Store
Thumbs.db
# Logs
*.log
12. Pro Tips — Daily Use
Tip 1: Commit Often, Push Daily
Bad: 1 huge commit at end of week
Good: 5-10 small commits daily
Small commits = easier rollbacks + clear history.
Tip 2: Commit Message Convention
Conventional Commits format:
feat: add login feature
fix: resolve null user bug
docs: update README
refactor: simplify auth logic
test: add user model tests
chore: update dependencies
Tip 3: Visual Git — GUI Tools
Command line nahi pasand?
- GitHub Desktop (free, official)
- GitKraken (powerful, paid)
- VS Code Source Control (built-in)
- Cursor's Git tab (best for AI coding)
Tip 4: Branch Naming Conventions
feature/user-profile
bugfix/login-error
hotfix/critical-security
refactor/cleanup-auth
docs/update-readme
13. Useful Aliases — Time Savers
Add to .gitconfig:
git config --global alias.s "status"
git config --global alias.c "commit -m"
git config --global alias.p "push"
git config --global alias.l "log --oneline --graph --all"Ab:
git s # status
git c "msg" # commit -m "msg"
git p # push
git l # pretty log14. GitHub Profile — Your Portfolio
GitHub profile = modern developer ka CV. Optimize karo:
Profile README:
GitHub mein same-name repository banao (e.g., babar-dev/babar-dev) — README.md root mein add karo:
# Hi, I'm Babar 👋
🚀 Full-stack developer from Pakistan 🇵🇰
💻 React, Next.js, TypeScript, Node.js
🔥 Currently learning AI integration
## 📊 GitHub Stats
[GitHub stats badges]
## 🛠 Tech Stack
[Tech logos]
## 📫 Contact
- LinkedIn: ...
- Portfolio: urducoder.vercel.appDaily Contributions:
GitHub graph green rakhne ke liye:
- Daily 1+ commit (kuch bhi — documentation, small fixes)
- Streak = visual proof of consistency
- Recruiters dekhte hain ye
15. Practice Project — Aaj Try Karo
Mini Project: Personal Portfolio Repo
# Folder banao
mkdir my-portfolio
cd my-portfolio
git init
# README banao
echo "# My Portfolio" > README.md
echo "Pakistani developer learning modern web stack" >> README.md
# Commit karo
git add README.md
git commit -m "Initial commit: portfolio setup"
# GitHub pe repo banao "my-portfolio"
# Remote add + push
git remote add origin https://github.com/YOUR_USERNAME/my-portfolio.git
git push -u origin mainDone! Tumhara pehla GitHub project live hai 🎉
🎯 Learning Path — 2 Hafte Mein Master
Week 1: Basics
- Day 1-2: Install + first commits
- Day 3-4: Branches + merging
- Day 5-7: GitHub + push/pull
Week 2: Advanced
- Day 8-10: Pull Requests + code reviews
- Day 11-12: Merge conflicts handling
- Day 13-14: Professional workflow + collaboration
🎓 Related Posts
- TypeScript Basics for JavaScript Devs (Next skill to learn)
- Next.js 16 Beginner Guide (Real project to practice Git on)
- CS Graduate Pakistan Job Guide (Git zaroori hai jobs ke liye)
- Cursor AI Complete Guide (Built-in Git integration)
Confused on any Git concept? Comment mein puchao — specific examples ke saath samjhaunga.
Pakistani devs ko share karo — Git skill compulsory hai 2026 mein 🇵🇰
Happy Versioning! 🌳
Written by UrduCoder
Pakistan ka #1 Roman Urdu coding blog. Hum AI, Web Dev, aur tech tutorials publish karte hain har hafte.
Related Posts
JavaScript Async/Await Asaan Tarike Se Samjho
JavaScript ka async/await pattern bilkul beginner-friendly tareeke se samjho. Promises, callbacks, aur error handling ke saath.
JWT Authentication Next.js Tutorial — Step by Step Roman Urdu Guide
JWT authentication kaise implement karein Next.js mein. Bcrypt password hashing, login/signup endpoints, protected routes, httpOnly cookies — complete production-ready guide.
Next.js 16 Complete Beginner Guide — Roman Urdu Mein Seekho
Next.js 16 ka complete beginner guide Roman Urdu mein. Turbopack, App Router, Server Components, React 19, async params — sab kuch step-by-step examples ke saath.