Back to Blog|⚛️ Web Development

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.

U
UrduCoder
••13 min read
Git & GitHub Basics — Beginner Guide 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

LOCAL TOOL
💰 Free + Open SourceVisit Site →

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

ONLINE SERVICE
💰 Free for personal useVisit Site →

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:

  1. Download: git-scm.com
  2. Installer run karo
  3. Default settings rakho (next, next, next)

Mac:

brew install git

Linux:

sudo apt install git

Verify Installation:

Terminal mein:

git --version

Output: 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 main

3. First Git Repository

Chalo practical karte hain.

Step 1: New Project Folder

Terminal mein:

mkdir my-first-project
cd my-first-project

Step 2: Initialize Git

git init

Output: 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.txt

Step 4: Check Status

git status

Output:

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.txt

Ya 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 log

Output:

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

CommandKya Karta Hai
git initNew repo banaye
git statusCurrent state dikhaye
git add <file>File stage kare
git commit -m "msg"Save version
git logHistory dekhe
git diffChanges dikhaye
git pullRemote se latest laye
git pushLocal 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 differences

5. 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 branch

Modern Way (Git 2.23+):

git switch main                # Switch to main
git switch -c new-feature      # Create + switch

Practical 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 dikhega

Tumhara 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-feature

6. GitHub — Cloud Pe Code

Step 1: GitHub Account Banao

  1. github.com pe jao
  2. Sign Up karo (free)
  3. Username choose karo (e.g., babar-dev)
  4. Same email use karo jo git config mein use ki thi

Step 2: New Repository Banao

  1. GitHub homepage pe "+" icon → New Repository
  2. Repository name: my-first-project
  3. Public select karo (portfolio ke liye)
  4. Don't initialize with README (since local mein already hai)
  5. 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 main

Pehli 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:

  1. GitHub pe login karo
  2. Profile (right top) → Settings
  3. Developer settings (bottom left)
  4. Personal access tokens → Tokens (classic)
  5. Generate new token (classic)
  6. Note: "My laptop" type kuch
  7. Expiration: 90 days
  8. Scopes: ✅ repo (full repo access)
  9. Generate token
  10. 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 karo

8. 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-profile

9. 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:

  1. GitHub pe repo open karo
  2. Banner dikhega: "feature/user-profile had recent pushes — Compare & pull request"
  3. Create Pull Request click karo
  4. Title descriptive likho: "Add user profile feature with avatar"
  5. Description mein details:
    • Kya change kiya
    • Kyun kiya
    • Screenshots (UI changes)
    • Testing kaise ki
  6. Reviewers add karo (team members)
  7. 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 aaya

File khulne pe Git ye dikhata hai:

<<<<<<< HEAD
Hello World
=======
Hi Universe
>>>>>>> origin/main

Fix Karna:

  1. File khol karo VS Code mein
  2. Decide karo konsi rakhni hai (ya dono combine)
  3. Markers remove karo (<<<, ===, >>>)
  4. File save karo
  5. Stage + commit:
git add file.txt
git commit -m "Resolve merge conflict in file.txt"
git push

VS 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

  1. Sensitive data commit karna — .env files, API keys, passwords
  2. Bara files commit karna — node_modules, .next, build folders
  3. Generic commit messages — "update", "fix bug", "changes"
  4. Force push to main — git push -f — team ka kaam destroy ho sakta hai
  5. git pull --force use karna — local changes lose
  6. Main branch pe directly commit — always branches use karo
  7. Old branches accumulate karna — regularly cleanup
  8. .gitignore na use karna — junk files commit ho jate hain
  9. 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 log

14. 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.app

Daily 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 main

Done! 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
2 Hafte
Git basics to confident user

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! 🌳

Tags:#git#github#version-control#tutorial#beginner#developer-tools
Share:
U

Written by UrduCoder

Pakistan ka #1 Roman Urdu coding blog. Hum AI, Web Dev, aur tech tutorials publish karte hain har hafte.