Git Workflows (GitFlow)
In this page:
git checkout -b develop main
git checkout -b feature/feature_name develop
git checkout develop
git merge feature/feature_name
GitFlow Initialize करना
GitFlow एक branching model है जो हर branch type को एक specific role assign करता है — ongoing integration के लिए develop, नए काम के लिए feature/*, stabilization के लिए release/*, urgent production fixes के लिए hotfix/* — बजाय हर किसी के एक shared branch में commit करने के। यह scheduled releases वाले projects को suit करता है जहाँ आपको यह clear separation चाहिए कि क्या stable है और क्या progress में है।
उदाहरण: Initializing GitFlow
git checkout -b develop main
git checkout -b feature/login develop
Features Develop करना
एक feature branch develop से cut होती है, isolation में बनती है, और खत्म होने पर वापस develop में merge होती है — लेकिन वह merge एक deliberate step है जिसे आप (या एक pull request) trigger करते हैं, GitFlow automatically नहीं करता। features को इस तरह isolated रखने का मतलब है कि एक unfinished feature कभी उस चीज़ को block या destabilize नहीं करती जिसे बाकी सब integrate कर रहे हैं।
उदाहरण: Developing Features
git checkout -b feature/cart develop
git checkout develop
git merge feature/cart
Releases तैयार करना
एक release branch develop से एक बार fork होती है जब उसमें एक release के लिए काफी features हों, और सिर्फ last-mile काम के लिए इस्तेमाल होती है — bug fixes, version bumps, documentation — कभी नए features नहीं। ready होने पर, यह main (ship करने के लिए) और वापस develop (ताकि वे same fixes ongoing काम से न खो जाएँ) दोनों में merge होती है।
उदाहरण: Preparing Releases
git checkout -b release/1.0 develop
git checkout main
git merge release/1.0
git checkout develop
git merge release/1.0
Hotfixes Execute करना
एक hotfix branch सीधे main से fork होती है ताकि यह develop पर इस समय चल रहे किसी भी काम का wait किए बिना एक live production bug patch कर सके। एक release branch की तरह, यह खत्म होने पर main और develop दोनों में merge होती है, यह ensure करते हुए कि fix तुरंत ship हो और अगले regular release से गलती से revert न हो।
उदाहरण: Executing Hotfixes
git checkout -b hotfix/critical-bug main
git checkout main
git merge hotfix/critical-bug
git checkout develop
git merge hotfix/critical-bug
Features Publish करना
एक local feature branch को remote पर push करना (git push -u origin feature/x) एक private, local branch को कुछ ऐसे में बदल देता है जिसे teammates देख, checkout, और collaborate कर सकते हैं — आमतौर पर वह point जिस पर आप early feedback के लिए एक pull request भी खोलेंगे।
उदाहरण: Publishing Features
git push -u origin feature/x
developके बजायmainसे एक feature branch करना, GitFlow structure तोड़ते हुए।- एक release branch को सिर्फ
mainमें merge करना और इसे वापसdevelopमें merge करना भूल जाना। - continuously release होने वाले एक छोटे project के लिए GitFlow इस्तेमाल करना, जो बिना किसी benefit के branches add करता है।
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: