git branch

git

इस्तेमाल

git branch [-a|-vv] [-d <name>]

branch सूचीबद्ध करता, बनाता और स्थानीय रूप से मिटाता है; मिटाने पर remote की प्रति बची रहती है, सर्वर के लिए git push origin --delete अलग से चाहिए।

आम विकल्प

विकल्पअर्थ
-alocal and remote-tracking branches
-rremote-tracking branches only
-vvlast commit and upstream of each branch
-d <name>delete a branch that is already merged
-D <name>delete it even if unmerged; those commits are left behind
-m <old> <new>rename
--mergedbranches already contained in the current one
--show-currentprint the branch you are on

उदाहरण

git branch -vv

every local branch with its upstream and last commit

git branch -d old-feature

removes a merged branch locally only

git push origin --delete old-feature

the separate step that removes it on the server

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

कैसे पढ़ें

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

आम सवाल

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

branch सूचीबद्ध करता, बनाता और स्थानीय रूप से मिटाता है; मिटाने पर remote की प्रति बची रहती है, सर्वर के लिए git push origin --delete अलग से चाहिए।

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

git branch [-a|-vv] [-d <name>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-branch