git fetch

git

इस्तेमाल

git fetch [--all] [--prune] [<remote> [<branch>]]

नए commit उतार लेता है पर आपकी फ़ाइलों और branch को नहीं छूता, इसलिए merge या rebase बाद में करना पड़ता है, और सर्वर पर मिटी branch --prune तक दिखती रहती है।

आम विकल्प

विकल्पअर्थ
--allfrom every remote
--prunedelete tracking refs whose branch is gone on the server
--tagsalso fetch tags
--unshallowfill in the history a --depth clone left out
--depth <n>deepen a shallow clone by n commits
-fupdate a ref even when it is not a fast-forward

उदाहरण

git fetch --all --prune

refreshes every remote and clears dead branches

git fetch origin main

updates origin/main without touching your files

git fetch --unshallow

turns a shallow clone into a full one

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

कैसे पढ़ें

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

आम सवाल

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

नए commit उतार लेता है पर आपकी फ़ाइलों और branch को नहीं छूता, इसलिए merge या rebase बाद में करना पड़ता है, और सर्वर पर मिटी branch --prune तक दिखती रहती है।

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

git fetch [--all] [--prune] [<remote> [<branch>]] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-fetch