staging area (หรือที่เรียกว่า index) เป็นพื้นที่ตรงกลางระหว่าง working directory ของคุณกับ repository — ที่ซึ่งคุณ เตรียม ว่าการเปลี่ยนแปลงใดจะเข้าไปอยู่ใน commit ถัดไป มันช่วยให้คุณสร้าง commit ได้อย่างแม่นยำ โดยเลือกอย่างชัดเจนว่าจะรวมอะไรเข้าไป
สามพื้นที่ของ Git
WORKING DIRECTORY → your actual files (where you edit)
│ git add
▼
STAGING AREA (index) → changes PREPARED for the next commit (a staging zone)
│ git commit
▼
REPOSITORY (.git) → committed snapshots (the permanent history)
การเปลี่ยนแปลงไหลไป: คุณแก้ไขไฟล์ (working directory), ทำการ stage การเปลี่ยนแปลงที่เลือก (staging area) และ บันทึกการเปลี่ยนแปลงที่ staged เป็น commit (repository)
