git stash บันทึกการเปลี่ยนแปลงที่ยังไม่ได้ commit ของคุณไว้ชั่วคราวและคืน working directory ของคุณกลับสู่สถานะที่สะอาด — เพื่อให้คุณสลับบริบทได้ (เช่นแก้บั๊กเร่งด่วนบนอีก branch หนึ่ง) โดยไม่ต้อง commit งานที่ทำค้างไว้ แล้วกู้คืนการเปลี่ยนแปลงในภายหลัง
ปัญหาที่ stash แก้ไข
You're mid-work with uncommitted changes, but need to switch context urgently:
→ switch branches? Git may refuse (uncommitted changes would conflict) or carry
them along messily
→ commit half-done work? No — it's not ready (pollutes history)
→ STASH saves your changes aside, giving you a clean working directory to switch.
