git reflog

git

इस्तेमाल

git reflog [show] [<ref>]

HEAD और आपकी branch जिन जगहों पर रही हैं, सब दर्ज रखता है; reset --hard या मिटी branch से खोए commit यहीं मिलते हैं, पर प्रविष्टियाँ डिफ़ॉल्ट 90 दिन में मिट जाती हैं और यह रिकॉर्ड सिर्फ़ आपकी मशीन पर होता है।

आम विकल्प

विकल्पअर्थ
show <ref>the positions of one branch instead of HEAD
--date=isoreal timestamps instead of relative ones
-n <n>only the last n entries
HEAD@{n}the commit HEAD pointed at n moves ago
expire --expire=now --allwipe the log, which also gives up the safety net

उदाहरण

git reflog

every position HEAD has had, newest first

git reflog --date=iso -n 20

the last twenty moves with real dates

git reset --hard HEAD@{1}

undoes the reset you just regretted

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

कैसे पढ़ें

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

आम सवाल

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

HEAD और आपकी branch जिन जगहों पर रही हैं, सब दर्ज रखता है; reset --hard या मिटी branch से खोए commit यहीं मिलते हैं, पर प्रविष्टियाँ डिफ़ॉल्ट 90 दिन में मिट जाती हैं और यह रिकॉर्ड सिर्फ़ आपकी मशीन पर होता है।

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

git reflog [show] [<ref>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-reflog