git archive
git
इस्तेमाल
git archive --format=tar.gz -o <file> <tree-ish>किसी एक commit की फ़ाइलों को tar या zip के रूप में बाहर लिखता है; .git और untracked फ़ाइलें छूट जाती हैं, इसलिए फ़ोल्डर को सीधे ज़िप करने से यह साफ़ release पैकेज बनता है।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| --format=<fmt> | tar, zip or tar.gz |
| -o <file> | write to a file; the format is guessed from the name |
| --prefix=<dir>/ | put everything under one folder inside the archive |
| --add-file=<file> | include an untracked file as well |
| --remote=<repo> | let the server build it |
| -l | list the formats this build supports |
उदाहरण
git archive --format=tar.gz -o app-1.2.0.tar.gz v1.2.0a release tarball of exactly that tag
git archive --prefix=app/ -o app.zip HEADa zip whose contents sit inside app/
git archive -o src.zip HEAD -- srconly the src directory
उलझन यह है कि पीछे लौटने के कई रूप हैं — ब्रांच का इशारा हटाना और उलटने वाला कमिट जोड़ना एक बात नहीं।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. git archive क्या करता है?
किसी एक commit की फ़ाइलों को tar या zip के रूप में बाहर लिखता है; .git और untracked फ़ाइलें छूट जाती हैं, इसलिए फ़ोल्डर को सीधे ज़िप करने से यह साफ़ release पैकेज बनता है।
Q. इसे कैसे लिखें?
git archive --format=tar.gz -o <file> <tree-ish> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 6 दिए हैं; पूरी सूची man git में है। यह कमांड git में आती है।
मिलती-जुलती कमांड
man पेज: man git-archive