GitHub Flow
In this page:
git switch -c branch-name
git add file_name
git commit -m "message"
git push -u origin branch-name
# then open a pull request and merge into main
GitHub Flow क्या है
GitHub Flow एक single long-lived main branch और short-lived feature branches के आसपास बना एक lightweight branching model है -- GitFlow के कई permanent branches (develop, release, hotfix) के उलट, GitHub Flow deliberately continuously deploy करने वाली teams के लिए process overhead minimize करने के लिए सिर्फ एक permanent branch रखता है।
उदाहरण: What is GitHub Flow
git checkout main
git checkout -b add-search
Main से Branch करना
काम का हर piece -- एक feature, एक fix, एक experiment -- को अपनी descriptively-named branch मिलती है जो सीधे main से cut होती है, पहले किसी intermediate develop branch से गुज़रे बिना।
उदाहरण: Branch From Main
git checkout main
git checkout -b fix-header-bug
जल्दी एक Pull Request खोलना
GitHub Flow एक branch exist करते ही एक pull request खोलने को encourage करता है, काम पूरा होने से पहले भी -- PR feedback, CI results, और progress visibility के लिए एक चलती हुई conversation thread बन जाती है, सिर्फ एक final review gate नहीं।
उदाहरण: Open a Pull Request Early
git push -u origin fix-header-bug
# open a pull request immediately, even before work is complete
Merge और Deploy करना
एक बार एक pull request review हो जाए और उसके checks pass हो जाएँ, इसे सीधे main में merge किया जाता है -- और क्योंकि इस model में main को हमेशा deployable माना जाता है, वह merge आमतौर पर तुरंत एक automatic या one-click production deployment के बाद आती है।
उदाहरण: Merge and Deploy
git checkout main
git merge fix-header-bug
git push origin main
GitHub Flow बनाम GitFlow
GitHub Flow GitFlow की structured release/hotfix branches को simplicity के लिए trade करता है: sync में रखने के लिए कोई अलग develop branch नहीं, और कोई scheduled release branch नहीं -- main में हर merge एक potential deploy है, जो continuous delivery practice करने वाली teams को GitFlow के ज़्यादा deliberate, versioned release cadence से कहीं बेहतर suit करता है।
उदाहरण: GitHub Flow vs GitFlow
git checkout -b feature-x main
# merges straight to main, no develop branch
- पहले एक branch बनाने के बजाय सीधे
mainमें commit करना, जो review bypass कर देता है। - branches को vaguely
fixयाtestजैसा नाम देना, जबकिadd-searchजैसे descriptive names purpose दिखाते हैं। - एक branch को हफ्तों के लिए खुला छोड़ना, ताकि
mainआगे बढ़ जाए और merge मुश्किल हो जाए; branches short-lived रखें।
- Branches आपको development की अलग lines पर काम करने देते हैं, और आप उन्हें
git branch,git checkout, औरgit switchसे बनाते और बदलते हैं। git merge,git rebase, औरgit cherry-pickchanges को साथ लाते हैं।- Branch strategies और GitHub Flow describe करते हैं कि teams branches को कैसे organize करती हैं।
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: