Git Pull Requests
In this page:
git push -u origin branch_name
# open a pull request on the hosting platform
एक Pull Request क्या है?
एक pull request एक feature branch पर commits bundle करता है और उन्हें किसी दूसरी branch में merge करने का प्रस्ताव देता है, reviewers को एक dedicated जगह देते हुए line-by-line comments छोड़ने, changes request करने, और actually merge होने से पहले approve करने के लिए। यह Git के ऊपर ही एक review gate layered है — platform (GitHub, GitLab, वगैरह) इसे track करता है, Git नहीं।
उदाहरण: What is a Pull Request?
git push -u origin feature-login
# then open a pull request on the hosting platform
एक Pull Request में Local Commits Push करना
क्योंकि एक pull request सिर्फ एक branch की ओर point करता है commits के एक fixed set के बजाय, उस branch में नई commits push करना PR को automatically update कर देता है — reviewers को आपके एक दूसरा request खोले बिना नए changes दिखते हैं।
उदाहरण: Pushing Local Commits to a Pull Request
git commit -m "Address review comments"
git push
एक Pull Request Locally Fetch और Test करना
किसी और की PR को locally checkout करना — GitHub पर git fetch origin pull/ID/head:branch-name से, या दूसरे platforms पर एक similar remote ref से — आपको approve करने से पहले actually अपनी machine पर उनका code और tests चलाने देता है, जो एक diff view अकेले miss कर सकने वाली problems पकड़ता है।
उदाहरण: Fetching and Testing a Pull Request Locally
git fetch origin pull/42/head:pr-42
git checkout pr-42
एक Pull Request Merge करना
एक बार एक PR को required approvals मिल जाएँ और यह कोई automated checks pass कर ले, इसे merge करना इसकी commits को target branch में fold कर देता है — ज़्यादातर platforms एक regular merge commit, एक squash merge, या एक rebase के बीच एक choice offer करते हैं, हर एक history का एक अलग shape पीछे छोड़ते हुए।
उदाहरण: Merging a Pull Request
git checkout main
git merge --no-ff feature-login
Merged Branches Delete करना
एक merged feature branch ने अपना काम कर दिया और अगर छोड़ दी जाए तो बस clutter add करती है — इसे locally (git branch -d) और remote पर (git push origin --delete <branch>) दोनों जगह delete करना branch list को meaningful रखता है और लोगों को गलती से stale काम पर build करने से रोकता है।
उदाहरण: Deleting Merged Branches
git branch -d feature-login
git push origin --delete feature-login
- अपने fork के
mainसे एक pull request खोलना, ताकि बाद की unrelated commits भी इसमें add हो जाएँ। - review comments fix करने के लिए एक नई pull request बनाना, जबकि same branch में ज़्यादा commits push करना मौजूदा को update कर देता है।
- pull request को बहुत बड़ा बनाना, ताकि reviewers इसे follow न कर सकें।
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: