git gc

git

इस्तेमाल

git gc [--aggressive] [--prune=<date>]

बिखरे object पैक करता है और जिनका कोई सहारा नहीं उन्हें हटाकर .git छोटा करता है; --prune=now उन commit को भी फेंक देता है जिन्हें reflog पकड़े हुए था, और reset पलटने का सुरक्षा-जाल ख़त्म हो जाता है।

आम विकल्प

विकल्पअर्थ
--aggressiverepack harder; slow, occasionally worth it
--prune=<date>drop unreachable objects older than that
--prune=nowdrop them all, which also throws away reflog-only commits
--autodo nothing unless there is enough loose junk
--no-prunerepack but keep unreachable objects
-qno progress output

उदाहरण

git gc

packs loose objects and shrinks .git

git gc --auto

the cheap check git itself runs after some commands

git gc --prune=now --aggressive

smallest result, and no way back to lost commits

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

कैसे पढ़ें

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

आम सवाल

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

बिखरे object पैक करता है और जिनका कोई सहारा नहीं उन्हें हटाकर .git छोटा करता है; --prune=now उन commit को भी फेंक देता है जिन्हें reflog पकड़े हुए था, और reset पलटने का सुरक्षा-जाल ख़त्म हो जाता है।

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

git gc [--aggressive] [--prune=<date>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-gc