git describe

git

इस्तेमाल

git describe [--tags] [--dirty]

सबसे नज़दीकी tag से मौजूदा commit को v1.2.0-5-gabc1234 जैसा नाम देता है; डिफ़ॉल्ट रूप से यह केवल annotated tag देखता है, इसलिए lightweight tag के लिए --tags और बिना tag वाले repository के लिए --always चाहिए।

आम विकल्प

विकल्पअर्थ
--tagsuse lightweight tags too, not just annotated ones
--dirtyappend -dirty when the working tree has changes
--alwaysfall back to a bare hash when no tag is found
--longalways the full tag-count-hash form
--abbrev=<n>how many hash digits to print
--match <pattern>only consider matching tags

उदाहरण

git describe --tags --dirty

prints something like v1.2.0-5-gabc1234-dirty

git describe --always

never fails, even in a repository with no tags

git describe --match "v*" --long

ignores tags that are not versions

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

कैसे पढ़ें

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

आम सवाल

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

सबसे नज़दीकी tag से मौजूदा commit को v1.2.0-5-gabc1234 जैसा नाम देता है; डिफ़ॉल्ट रूप से यह केवल annotated tag देखता है, इसलिए lightweight tag के लिए --tags और बिना tag वाले repository के लिए --always चाहिए।

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

git describe [--tags] [--dirty] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-describe