Git Code Review
In this page:
git diff base_branch...feature_branch
git log base_branch..feature_branch
Git Diff से Changes Compare करना
git diff <base>...<branch> exactly दिखाता है कि एक branch इसके fork होने की जगह के relative क्या बदलता है, जो ज़्यादातर code reviews का starting point है — यह वह actual content है जिसे एक reviewer को evaluate करना है, सिर्फ commit messages या file list के बजाय।
उदाहरण: Comparing Changes with Git Diff
git diff main...feature-login
किसी Branch की Commit History देखना
git log <base>..<branch> सिर्फ उस branch की unique commits list करता है, एक reviewer को author की train of thought follow करने देते हुए — चाहे उन्होंने feature को focused commits के साथ incrementally बनाया हो या सब कुछ एक में dump कर दिया हो, जिस पर खुद अक्सर comment करने लायक होता है।
उदाहरण: Viewing Commit History of a Branch
git log main..feature-login
एक Specific Commit Checkout करना
git checkout <commit> (आपको एक detached-HEAD state में लाते हुए) एक reviewer को actually code को branch की history में किसी भी point पर existed था वैसे चलाने देता है, PR में एक specific claim verify करने या change द्वारा fix होने वाले एक bug को reproduce करने के लिए उपयोगी।
उदाहरण: Checking Out a Specific Commit
git checkout a1b2c3d
Git Blame से Authors ढूँढना
जब एक review को यह जानना हो कि (नई change खुद नहीं) मौजूदा code के किसी confusing हिस्से के बारे में किससे पूछना है, उस file पर git blame सीधे जिम्मेदार commit और author की ओर point करता है, review thread में एक round of "क्या किसी को पता है यह यहाँ क्यों है?" बचाते हुए।
उदाहरण: Finding Authors with Git Blame
git blame file.txt
Commits Inspect करने के लिए Git Show इस्तेमाल करना
git show <commit> एक single commit की metadata और diff एक साथ एक view में दिखाता है, जो अक्सर एक पूरे multi-commit branch diff में scroll करने से एक focused commit review करने के लिए तेज़ है।
उदाहरण: Using Git Show to Inspect Commits
git show a1b2c3d
git diff main..featureमें दो dots इस्तेमाल करना जब आपको तीन चाहिए,main...feature, जो branch fork होने की जगह के against compare करता है।- review के लिए एक commit checkout करना और detached-HEAD state में changes करना, जो आसानी से खो जाती हैं।
- सिर्फ final diff पढ़ना और
git log main..featureskip करना, commit messages में reasoning miss करते हुए।
Chapter Quiz — Complete all 6 topics to unlock
0/6 topics done
Complete these topics first: