GitHub Branch Rulesets ka complete guide jo aapko har ek rule ko samajhne mein madad karega — simple Hinglish mein likha gaya hai taaki koi bhi developer asaani se samajh sake!
Branch Rulesets GitHub ka ek powerful feature hai jo repository ke branches ko protect karta hai. Ye define karta hai ki:
- Kaun branch create kar sakta hai
- Kaun code push kar sakta hai
- Merge karne se pehle kya conditions puri honi chahiye
- Force push allowed hai ya nahi
Socho ek team mein 10 developers hain — agar sab log directly
mainbranch mein code push karenge toh production mein bugs aa jayenge. Isliye hum rules lagaate hain taaki code quality maintain rahe! 💪
github-ruleset/
│
├── README.md # Main documentation (ye file)
│
├── _00_introduction/
│ └── intro.md # Ruleset kya hai aur kyun zaruri hai
│
├── _01_restrict_creations/
│ ├── usecase.md # Kab use karna hai
│ └── rule_explanation.md # Rule ki detail explanation
│
├── _02_restrict_updates/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _03_restrict_deletions/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _04_require_linear_history/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _05_require_deployments_to_succeed/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _06_require_signed_commits/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _07_require_pull_request_before_merging/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _08_require_status_checks_to_pass/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _09_block_force_pushes/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _10_require_code_scanning_results/
│ ├── usecase.md
│ └── rule_explanation.md
│
├── _11_practice_scenario/
│ └── practice_project.md # Real-world practice case study
│
├── _12_naming_conventions_and_best_practices/
│ ├── usecase.md # Kab follow karna hai
│ └── rule_explanation.md # Naming patterns & best practices
│
└── _13_bypass_master/
└── bypass_explanation.md # Bypass list and options detail
| # | Rule Name | Kya Karta Hai | Priority |
|---|---|---|---|
| 00 | Introduction | Ruleset kya hai aur kyun zaruri hai | 🟢 Essential |
| 01 | Restrict Creations | Sirf authorized log hi new branch bana sakte hain | 🟡 Medium |
| 02 | Restrict Updates | Sirf kuch log hi branch mein code push kar sakte hain | 🟡 Medium |
| 03 | Restrict Deletions | Koi bhi important branch delete nahi kar sakta | 🔴 High |
| 04 | Require Linear History | Merge commits hatao, clean history rakho | 🟢 Low |
| 05 | Require Deployments to Succeed | Pehle deployment pass honi chahiye | 🔴 High |
| 06 | Require Signed Commits | Verified commits ensure karta hai ki code authentic hai | 🟡 Medium |
| 07 | Require PR Before Merging | Direct merge nahi, pehle Pull Request banao | 🔴 High |
| 08 | Require Status Checks | CI/CD tests pass hone chahiye merge se pehle | 🔴 High |
| 09 | Block Force Pushes | git push --force ko block karo |
🔴 High |
| 10 | Require Code Scanning | Security vulnerabilities check honi chahiye | 🟡 Medium |
| 12 | Naming Conventions & Best Practices | Rulesets ko properly name karo aur best practices follow karo | 🟢 Essential |
| 13 | Bypass Master | Bypass list aur unke actual meanings ki deep dive | 🔴 High |
_00_introduction/se shuru karein — ye batayega ruleset kya hai aur humein ise kyun samajhna chahiye.- Har folder mein jaao aur
usecase.mdpadho — ye batayega kab ye rule use karna chahiye. rule_explanation.mdpadho — ye batayega rule kaise kaam karta hai aur kaise set karna hai._11_practice_scenario/folder mein jaao — wahan ek real-world project case study hai jismein 5 developers ki team mein rulesets kaise apply hote hain._12_naming_conventions_and_best_practices/mein jaao — wahan naming patterns aur team-size based templates milenge._13_bypass_master/ko check karein — taaki aap samajh sakein ki bypass list mein kin options ka kya matlab hai.
GitHub mein Rulesets set karne ke liye:
- Apne repo mein jaao → Settings
- Left sidebar mein → Rules → Rulesets
- New ruleset pe click karo
- Branch target select karo
- Rules choose karo aur Save karo!
💡 Pro tip: Pehle
Disabledenforcement se test karo, phirActivekaro production mein!
Agar aapko lagta hai koi rule ki explanation aur acchi ho sakti hai ya koi nayi scenario add karni hai toh PR bhejo! 🎉
MIT License — Free to use, learn and share!
Made with ❤️ for the Indian Developer Community 🇮🇳