git blame

git

इस्तेमाल

git blame [-L <start>,<end>] <file>

हर पंक्ति के साथ वह commit दिखाता है जिसने उसे अंत में बदला; सिर्फ़ formatting वाला commit असली लेखक छिपा देता है, इसीलिए -w और --ignore-rev हैं।

आम विकल्प

विकल्पअर्थ
-L <a>,<b>only those lines
-wignore whitespace, so re-indenting stops hiding the author
-Cfollow code moved in from another file
--ignore-rev <rev>skip a commit, e.g. a bulk reformat
-eshow email addresses instead of names
-sdrop the author and date columns

उदाहरण

git blame -L 40,60 src/app.ts

who last touched lines 40 to 60

git blame -w -C src/app.ts

looks past whitespace and moved code

git blame --ignore-rev 9f3c2ab src/app.ts

ignores the commit that reformatted everything

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

कैसे पढ़ें

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

आम सवाल

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

हर पंक्ति के साथ वह commit दिखाता है जिसने उसे अंत में बदला; सिर्फ़ formatting वाला commit असली लेखक छिपा देता है, इसीलिए -w और --ignore-rev हैं।

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

git blame [-L <start>,<end>] <file> — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

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

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

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

man पेज: man git-blame