git log

git

इस्तेमाल

git log [--oneline] [--graph] [<range>] [-- <path>]

commit इतिहास नए से पुराने क्रम में दिखाता है, पर सिर्फ़ मौजूदा HEAD के पूर्वज; बाकी branch देखने के लिए --all चाहिए।

आम विकल्प

विकल्पअर्थ
--onelineone short line per commit
--graphdraw the branch lines
--allinclude every branch, not just the current one
-pshow the patch of each commit
--statshow which files changed
-n <n>stop after n commits
--since=<date>commits newer than a date, e.g. "2 weeks ago"
--followkeep following one file through renames

उदाहरण

git log --oneline --graph --all

the whole history as a compact graph

git log -p -- src/app.ts

every change ever made to one file

git log --since="2 weeks ago" --author=jade

recent commits by one person

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

कैसे पढ़ें

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

आम सवाल

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

commit इतिहास नए से पुराने क्रम में दिखाता है, पर सिर्फ़ मौजूदा HEAD के पूर्वज; बाकी branch देखने के लिए --all चाहिए।

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

git log [--oneline] [--graph] [<range>] [-- <path>] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-log