git submodule
git
इस्तेमाल
git submodule update --init --recursiveकिसी दूसरे repository को एक commit पर स्थिर करके आपके repository के भीतर रखता है; सादा clone उस फ़ोल्डर को update --init तक खाली छोड़ देता है, और parent branch नहीं, commit पकड़ता है।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| add <url> <path> | pin another repository at a path |
| update --init | fill in a submodule folder that a clone left empty |
| --recursive | go into submodules of submodules |
| update --remote | move the pin to the tip of the tracked branch |
| status | the commit each submodule sits at |
| deinit <path> | unregister it |
| foreach <cmd> | run a command in each one |
उदाहरण
git submodule update --init --recursivethe command that fills empty submodule folders after a clone
git submodule add https://github.com/x/lib.git vendor/libadds a dependency as a submodule
git submodule update --remoteupdates the pinned commit to the branch tip
उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. git submodule क्या करता है?
किसी दूसरे repository को एक commit पर स्थिर करके आपके repository के भीतर रखता है; सादा clone उस फ़ोल्डर को update --init तक खाली छोड़ देता है, और parent branch नहीं, commit पकड़ता है।
Q. इसे कैसे लिखें?
git submodule update --init --recursive — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 7 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।
मिलती-जुलती कमांड
man पेज: man git-submodule