GitHub क्या है?#
GitHub एक online platform है जहाँ developers अपने Git repositories को host, manage और collaborate कर सकते हैं।
Simple words mein:
Git आपके computer पर code की history manage करता है, जबकि GitHub आपके Git projects को online store और collaborate करने में मदद करता है।
Example:
Your Computer
↓
Git
↓
GitHub Repository
↓
Team / CollaborationGitHub पर आप:
- Code host कर सकते हैं
- Projects share कर सकते हैं
- Team के साथ collaborate कर सकते हैं
- Issues create कर सकते हैं
- Pull Requests बना सकते हैं
- Code review कर सकते हैं
- Open-source projects में contribute कर सकते हैं
- Project documentation maintain कर सकते हैं
Git और GitHub में क्या Difference है?#
यह सबसे important concepts में से एक है।
| Git | GitHub |
|---|---|
| Version Control System | Online development platform |
| Local machine पर चलता है | Internet-based platform |
| Changes track करता है | Repository host करता है |
| Commit करता है | Pull Request / Issues जैसी collaboration सुविधाएँ देता है |
| Branch manage करता है | Team collaboration में मदद करता है |
एक simple example:
Git = Version Control Tool
GitHub = Git Repository Hosting + Collaboration PlatformGitHub Git का replacement नहीं है।
GitHub Repository क्या है?#
Repository या short में repo, एक project का online home होता है।
Example:
my-project
├── README.md
├── src/
├── package.json
├── .gitignore
└── ...Repository में project का:
- Source code
- Git history
- README
- Branches
- Issues
- Pull Requests
- Other project files
हो सकते हैं।
GitHub Account और Repository#
GitHub पर काम करने के लिए पहले account बनाना होता है।
फिर आप:
GitHub Account
↓
Repository
↓
Project Codeबना सकते हैं।
एक account में multiple repositories हो सकती हैं।
Example:
account/
├── portfolio
├── ecommerce-app
├── weather-app
└── learning-projectGitHub Repository कैसे बनाएं?#
GitHub पर नया repository create करते समय सामान्यतः आपको:
- Repository name
- Description
- Public/Private visibility
- README
.gitignore- License
जैसी options मिल सकती हैं।
Example repository name:
my-react-appProject के purpose के अनुसार clear repository name रखना useful है।
Public और Private Repository#
GitHub repository की visibility important है।
Public Repository
Public repository को दूसरे लोग देख सकते हैं।
यह open-source projects और public portfolio के लिए useful हो सकती है।
Private Repository
Private repository का access restricted होता है।
इसका use:
- Private projects
- Company code
- Personal projects
- Internal development
के लिए किया जा सकता है।
GitHub README क्या है?#
README.md repository का introduction/documentation page होता है।
एक अच्छे README में हो सकता है:
Project Name
Description
Features
Installation
Usage
Screenshots
Configuration
Contributing
LicenseExample:
# My Project
A simple web application.
## Features
- User authentication
- Dashboard
- API integration
## Installation
npm installREADME project को समझने में नए developer की मदद करता है।
Local Project को GitHub पर Push करना#
मान लीजिए आपके computer पर project है:
my-project/सबसे पहले:
cd my-projectGit initialize करें:
git initFiles check करें:
git statusFiles add करें:
git add .Commit करें:
git commit -m "Initial commit"अब GitHub पर repository create करें।
फिर remote add करें:
git remote add origin <repository-url>Remote check करें:
git remote -vMain branch set कर सकते हैं:
git branch -M mainफिर push:
git push -u origin mainBasic flow:
Local Project
↓
git init
↓
git add
↓
git commit
↓
git remote add
↓
git push
↓
GitHubGitHub Repository Clone करना#
अगर repository पहले से GitHub पर है और आपको अपने computer पर उसकी copy चाहिए:
git clone <repository-url>Example:
git clone https://github.com/user/project.gitफिर:
cd projectअब आप local project पर काम कर सकते हैं।
GitHub से Latest Changes लेना#
Team project में दूसरे developers changes push कर सकते हैं।
Latest changes लेने के लिए:
git pullExample:
git pull origin mainSimple flow:
GitHub
↓
git pull
↓
Local ProjectGitHub पर Code Push करना#
Local changes commit करने के बाद:
git pushSpecific branch:
git push origin feature-loginपहली बार:
git push -u origin feature-loginइसके बाद:
git pushकाम कर सकता है।
GitHub Branch क्या है?#
Branch project की अलग development line होती है।
Example:
main
│
├── feature-login
├── feature-payment
└── bugfix-navbarTeam development में अलग feature के लिए branch बनाई जा सकती है।
Example:
git switch -c feature-loginफिर code लिखें और commit करें।
Main Branch#
main आमतौर पर repository की primary branch होती है।
Example:
mainलेकिन अलग projects अपनी branching strategy के अनुसार अलग naming या workflow use कर सकते हैं।
Important बात यह है कि branch का नाम project/team workflow पर depend कर सकता है।
GitHub Branch Push करना#
नई branch:
git switch -c feature-loginChanges:
git add .
git commit -m "Add login feature"Push:
git push -u origin feature-loginअब branch GitHub repository में भी available हो सकती है।
Pull Request क्या है?#
Pull Request (PR) GitHub का important collaboration feature है।
जब आप किसी branch में changes करते हैं और उन्हें दूसरे branch में merge करवाना चाहते हैं, तो Pull Request बनाया जा सकता है।
Example:
feature-login
↓
Pull Request
↓
mainPR में team members:
- Changes review कर सकते हैं
- Comments कर सकते हैं
- Code discuss कर सकते हैं
- Required changes मांग सकते हैं
- Approve कर सकते हैं
- Merge कर सकते हैं
Pull Request का Practical Workflow#
मान लीजिए आपको login feature बनाना है।
Step 1 — Branch बनाएं
git switch -c feature-loginStep 2 — Code करें
login.js
login.css
login.htmlStep 3 — Commit करें
git add .
git commit -m "Add login feature"Step 4 — GitHub पर Push करें
git push -u origin feature-loginStep 5 — Pull Request बनाएं
GitHub पर:
feature-login
↓
Pull Request
↓
mainStep 6 — Review
Team changes review करती है।
Step 7 — Merge
Approved होने के बाद PR merge किया जा सकता है।
Fork क्या है?#
Fork किसी दूसरे GitHub repository की अपने GitHub account में copy बनाने का तरीका है।
यह open-source contribution में commonly useful होता है।
Example:
Original Repository
↓
Fork
↓
Your GitHub Account
↓
Your ChangesFork और clone same चीज़ नहीं हैं।
Fork
GitHub पर repository की copy बनाता है।
Clone
Repository को local computer पर copy करता है।
Fork और Clone का Difference#
| Fork | Clone |
|---|---|
| GitHub account में repository copy | Local computer में repository copy |
| GitHub पर होता है | Computer पर होता है |
| Open-source contribution में useful | Local development में useful |
| Original repo से अलग remote हो सकता है | Local Git repository बनती है |
Open Source Contribution Workflow#
एक common open-source workflow:
Original Repository
↓
Fork
↓
Your GitHub
↓
Clone
↓
Create Branch
↓
Code
↓
Commit
↓
Push
↓
Pull Request
↓
Original Repositoryयही workflow समझना GitHub सीखने का important part है।
GitHub Issues क्या हैं?#
Issues repository में bugs, tasks, improvements और discussions track करने के लिए use किए जा सकते हैं।
Example:
Issue #24
Fix mobile navigationIssue में:
- Description
- Labels
- Assignees
- Comments
- Status
जैसी information हो सकती है।
Example issues:
Bug: Login button not working
Feature: Add dark mode
Task: Update documentationGitHub Labels#
Issues और Pull Requests को categorize करने के लिए labels useful हैं।
Example:
bug
feature
documentation
enhancement
help wanted
good first issueइससे project management आसान हो सकता है।
GitHub Code Review#
Pull Request के दौरान developers code review कर सकते हैं।
Reviewer:
Review Code
↓
Comment
↓
Request Changes / ApproveCode review का purpose सिर्फ mistakes ढूँढना नहीं है।
यह:
- Code quality
- Maintainability
- Security
- Bugs
- Project conventions
जैसी चीजों को check करने में भी मदद कर सकता है।
GitHub Actions क्या है?#
GitHub Actions repository में automated workflows run करने के लिए use किया जा सकता है।
Example:
Push Code
↓
GitHub Actions
↓
Run Tests
↓
Build
↓
Deployइस तरह repetitive development tasks automate किए जा सकते हैं।
Example use cases:
- Tests run करना
- Build करना
- Linting
- Deployment
- Scheduled workflows
GitHub Releases#
जब project का कोई important version release होता है, तो GitHub Releases का use किया जा सकता है।
Example:
v1.0.0
v1.1.0
v2.0.0Tags और releases project versions को organize करने में useful हो सकते हैं।
GitHub .gitignore#
.gitignore उन files/folders को specify करता है जिन्हें Git track नहीं करे।
Example:
node_modules/
.env
dist/
*.logNode.js project में:
node_modules/को generally repository में commit नहीं किया जाता।
Sensitive configuration:
.envको भी carefully handle करना चाहिए।
GitHub पर Secrets क्यों Important हैं?#
कभी भी source code में directly sensitive information डालने से बचें।
Example:
const API_KEY = "secret-key";इसके बजाय environment variables और appropriate secret-management mechanisms use करें।
गलती से secret repository में push हो जाए तो सिर्फ file delete करना हमेशा sufficient नहीं होता; secret को rotate/revoke करना भी आवश्यक हो सकता है।
GitHub Profile को Developer Portfolio की तरह Use करना#
GitHub profile आपके development work को showcase कर सकती है।
Useful चीजें:
- Good README
- Useful repositories
- Clear project descriptions
- Meaningful commit history
- Documentation
- Open-source contributions
Repository का नाम और README ऐसा रखें कि कोई developer project को जल्दी समझ सके।
GitHub Repository Naming Tips#
Bad:
test
project123
newproject
abcBetter:
react-task-manager
php-invoice-system
wordpress-epaper-manager
weather-dashboardनाम देखकर project का purpose समझ आना चाहिए।
GitHub README में क्या लिखें?#
एक practical README structure:
# Project Name
Short description
## Features
- Feature 1
- Feature 2
- Feature 3
## Tech Stack
- React
- Node.js
- MySQL
## Installation
npm install
## Usage
npm run dev
## Screenshots
...
## Contributing
...
## License
...Project की जरूरत के हिसाब से sections add/remove किए जा सकते हैं।
GitHub के साथ Daily Developer Workflow#
एक common workflow:
git pullनई branch:
git switch -c feature-nameCode करें।
फिर:
git statusChanges stage करें:
git add .Commit:
git commit -m "Add new feature"Push:
git push -u origin feature-nameफिर GitHub पर Pull Request बनाया जा सकता है।
Common GitHub Mistakes#
1. .env GitHub पर push करना
Sensitive data accidentally public हो सकता है।
Use:
.gitignoreऔर secrets को safely manage करें।
2. Directly main पर changes करना
Team projects में feature branch workflow useful हो सकता है।
git switch -c feature-name3. Pull किए बिना काम शुरू करना
Team project में local branch पुरानी हो सकती है।
git pullproject workflow के अनुसार useful हो सकता है।
4. Meaningless commit messages
Avoid:
git commit -m "update"Better:
git commit -m "Fix checkout validation"5. README खाली छोड़ना
एक अच्छा README project को समझने में काफी मदद करता है।
6. Large/generated files commit करना
Build output, dependencies और unnecessary generated files को project-specific .gitignore में handle करें।
GitHub और Git को साथ में कैसे याद रखें?#
एक simple mental model:
Git
↓
Local Version Control
↓
Commit
↓
GitHub
↓
Remote Repository
↓
Push / Pull
↓
Team CollaborationFeature workflow:
GitHub
↓
Clone / Pull
↓
Branch
↓
Code
↓
Commit
↓
Push
↓
Pull Request
↓
Review
↓
MergeGitHub Commands Quick Reference#
| काम | Command |
|---|---|
| Repository clone | git clone <url> |
| Repository initialize | git init |
| Status | git status |
| Add file | git add <file> |
| Add all | git add . |
| Commit | git commit -m "message" |
| Remote check | git remote -v |
| Remote add | git remote add origin <url> |
| Push | git push |
| First branch push | git push -u origin <branch> |
| Pull | git pull |
| Fetch | git fetch |
| Branch list | git branch |
| Create branch | git branch <name> |
| Create + switch | git switch -c <name> |
| Switch branch | git switch <name> |
| Merge | git merge <branch> |
| Log | git log --oneline |
| Stash | git stash |
| Stash restore | git stash pop |
GitHub Workflow Cheat Sheet#
New GitHub Project
git init
git add .
git commit -m "Initial commit"
git remote add origin <url>
git branch -M main
git push -u origin mainExisting GitHub Project
git clone <url>
cd project
git pullNew Feature
git switch -c feature-name
git add .
git commit -m "Add feature"
git push -u origin feature-nameफिर:
Create Pull Request
↓
Review
↓
MergeKnowledge Check#
Q1. GitHub क्या है?
A. Programming Language
B. Online development and repository platform
C. Database
D. Operating System
Answer: B
Q2. Repository को local computer पर लाने के लिए?
A. git download
B. git clone
C. git copy
D. git pull-project
Answer: B
Q3. Local commits को GitHub पर भेजने के लिए?
A. git pull
B. git fetch
C. git push
D. git send
Answer: C
Q4. Pull Request का purpose क्या है?
A. Computer बंद करना
B. Code changes को review और merge workflow में लाना
C. Git install करना
D. Repository delete करना
Answer: B
Q5. Fork क्या करता है?
A. Repository को delete करता है
B. GitHub account में repository की copy बनाता है
C. Local files remove करता है
D. Commit revert करता है
Answer: B
Practical Exercises#
Exercise 1 — GitHub Repository बनाएं
एक नया repository बनाएं:
github-practiceफिर local project initialize करके GitHub पर push करें।
Exercise 2 — Branch बनाएं
git switch -c feature-testएक छोटा change करें:
git add .
git commit -m "Add feature test"
git push -u origin feature-testफिर GitHub पर branch देखें।
Exercise 3 — Pull Request बनाएं
अपनी feature branch से:
feature-test
↓
Pull Request
↓
mainPR create करें और changes review करें।
Exercise 4 — README बनाएं
अपने project में:
README.mdबनाकर ये sections add करें:
Project Name
Description
Features
Tech Stack
Installation
UsageExercise 5 — .gitignore Practice
एक .gitignore file बनाएं और project के unnecessary files/folders add करें।
Example:
node_modules/
.env
dist/फिर:
git statusसे verify करें।
Summary#
आसान भाषा में:
Git local version control है और GitHub Git repositories को online host और collaborate करने का platform है।
GitHub के सबसे important concepts:
Repository
Branch
Commit
Push
Pull
Fork
Pull Request
Issues
Code Review
GitHub Actions
README
.gitignoreसबसे important workflow:
Clone / Pull
↓
Create Branch
↓
Write Code
↓
Commit
↓
Push
↓
Pull Request
↓
Review
↓
MergeGit सीखने के बाद GitHub सीखने का main goal commands याद करना नहीं है, बल्कि remote repository और collaborative development workflow समझना है।