Introduction to Git
George Boorman
Curriculum Manager, DataCamp

git diff - ความแตกต่างระหว่างเวอร์ชัน
git diff report.md




report.md ไปยัง staging areagit add report.md
report.md กับเวอร์ชันที่อยู่ใน staging areagit diff --staged report.md

git diff --staged

ค้นหา commit hash
git log
เปรียบเทียบ hash ทั้งสอง
git diff 35f4b4d 186398f
ดูสิ่งที่เปลี่ยนแปลงจาก hash แรกไปยัง hash ที่สอง
HEADgit diff HEAD~1 HEAD

| คำสั่ง | หน้าที่ |
|---|---|
git diff |
แสดงการเปลี่ยนแปลงระหว่างไฟล์ที่ยังไม่ได้ stage ทั้งหมดกับ commit ล่าสุด |
git diff report.md |
แสดงการเปลี่ยนแปลงระหว่างไฟล์ที่ยังไม่ได้ stage กับ commit ล่าสุด |
git diff --staged |
แสดงการเปลี่ยนแปลงระหว่างไฟล์ที่ stage ทั้งหมดกับ commit ล่าสุด |
git diff --staged report.md |
แสดงการเปลี่ยนแปลงระหว่างไฟล์ที่ stage แล้วกับ commit ล่าสุด |
git diff 35f4b4d 186398f |
แสดงการเปลี่ยนแปลงระหว่างสอง commit โดยใช้ hash |
git diff HEAD~1 HEAD~2 |
แสดงการเปลี่ยนแปลงระหว่างสอง commit โดยใช้ HEAD แทน commit hash |
Introduction to Git