git pull

git

इस्तेमाल

git pull [--rebase|--ff-only] [<remote> <branch>]

fetch और merge को एक ही बार में करता है, यहीं से अनचाहे merge commit आते हैं; --rebase या --ff-only उन्हें रोकता है।

आम विकल्प

विकल्पअर्थ
--rebasereplay your commits on top instead of merging
--ff-onlyrefuse if a merge commit would be needed
--no-rebasemerge, whatever pull.rebase says
--autostashpark local changes for the duration
--prunedrop tracking refs for deleted branches
--depth <n>shallow pull

उदाहरण

git pull --rebase origin main

brings in server commits and puts yours on top

git pull --ff-only

updates only when nothing has to be merged

git pull --autostash

pulls even with uncommitted changes in the way

उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. git pull क्या करता है?

fetch और merge को एक ही बार में करता है, यहीं से अनचाहे merge commit आते हैं; --rebase या --ff-only उन्हें रोकता है।

Q. इसे कैसे लिखें?

git pull [--rebase|--ff-only] [<remote> <branch>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 6 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।

मिलती-जुलती कमांड

man पेज: man git-pull