# Git Flow बनाम Trunk-Based — Git Fundamentals: Commits, Branches और Collaboration

Source: https://www.skillbyai.com/hi/git/git-gitflow-trunk

> Git Flow और trunk-based development की तुलना करें और अपनी team के लिए branching strategy चुनें।

## Git Flow

**Git Flow** लंबे समय तक चलने वाली `develop` और `main` ब्रांच के साथ समर्पित `feature/`, `release/`, और `hotfix/` ब्रांच उपयोग करता है। संरचित, पर तेज़ी से चलने वाली टीमों के लिए भारी।

## Trunk-based development

हर कोई छोटे, बार-बार के बदलाव सीधे एक ही `main` ट्रंक में (या बहुत छोटी ब्रांच के ज़रिए) कमिट करता है, अक्सर फ़ीचर फ़्लैग के पीछे — यह कंटीन्यूअस डिलीवरी के लिए पसंदीदा है।

**Quiz:** कौन-सी रणनीति एक ही trunk में छोटे, बार-बार के कमिट को प्राथमिकता देती है?

- [ ] Git Flow
- [ ] दोनों समान रूप से
- [x] Trunk-based development
- [ ] कोई नहीं

*Answer:* Trunk-based development. Trunk-based development लंबी ब्रांच से बचकर main में कंटीन्यूअस इंटीग्रेशन को प्राथमिकता देता है।

## अंतिम क्विज़ 1/8

अंतिम क्विज़

**Quiz:** git add क्या करता है?

- [ ] Uploads to GitHub
- [ ] Deletes files
- [x] Stages changes for the next commit
- [ ] Creates a branch

*Answer:* Stages changes for the next commit. Staging तय करता है कि अगले commit में क्या जाएगा।

## अंतिम क्विज़ 2/8

अंतिम क्विज़

**Quiz:** कौन-सा command नई branch बनाकर उस पर जाता है?

- [ ] git branch -d name
- [ ] git merge name
- [ ] git init name
- [x] git switch -c name

*Answer:* git switch -c name. -c branch बनाता है।

## अंतिम क्विज़ 3/8

अंतिम क्विज़

**Quiz:** Merge conflict कब होता है?

- [x] Two branches change the same lines differently
- [ ] A branch is renamed
- [ ] The remote is offline
- [ ] You forget git status

*Answer:* Two branches change the same lines differently. Git प्रतिस्पर्धी edits में से चुन नहीं सकता।

## अंतिम क्विज़ 4/8

अंतिम क्विज़

**Quiz:** Push हो चुके commit को सुरक्षित रूप से कौन-सा command undo करता है?

- [ ] git reset --hard
- [x] git revert
- [ ] git rebase -i
- [ ] git stash

*Answer:* git revert. revert नया commit जोड़ता है जो पुराने को रद्द करता है।

## अंतिम क्विज़ 5/8

अंतिम क्विज़

**Quiz:** कौन-सा reset mode working changes हटा देता है?

- [ ] --soft
- [ ] --mixed
- [x] --hard
- [ ] --keep-history

*Answer:* --hard. --hard index और working tree reset करता है।

## अंतिम क्विज़ 6/8

अंतिम क्विज़

**Quiz:** Shared branches को rebase करने से क्यों बचें?

- [ ] It is slow
- [ ] It deletes tags
- [ ] It needs admin rights
- [x] It rewrites history others already pulled

*Answer:* It rewrites history others already pulled. बदले हुए commits साथियों की copies से अलग हो जाते हैं।

## अंतिम क्विज़ 7/8

अंतिम क्विज़

**Quiz:** git stash क्या करता है?

- [x] Shelves uncommitted changes temporarily
- [ ] Deletes the repo
- [ ] Pushes to remote
- [ ] Renames a branch

*Answer:* Shelves uncommitted changes temporarily. pop या apply उन्हें वापस लाता है।

## अंतिम क्विज़ 8/8

अंतिम क्विज़

**Quiz:** कौन-सा command वह commit खोजता है जिसने bug पैदा किया?

- [ ] git cherry-pick
- [x] git bisect
- [ ] git remote
- [ ] git config

*Answer:* git bisect. bisect good और bad commits के बीच history में binary search करता है।
