Branches ใน Git ช่วยให้คุณแยกออกจากสายหลักของการพัฒนาเพื่อทำงานบางอย่างใน สภาวะแยกตัว (isolation) — โดยไม่กระทบโค้ดหลัก มันมีน้ำหนักเบาและเป็นแกนกลางของเวิร์กโฟลว์ Git ทำให้ทำงานแบบขนานและทดลองได้อย่างปลอดภัย
branch คืออะไร
A branch is a MOVABLE POINTER to a commit. The default is usually "main".
→ creating a branch = creating a new pointer (cheap/instant — not a copy of files)
→ commits on a branch advance that branch's pointer
→ branches let you work on different things in parallel, isolated from each other
Branches มี (เป็นเพียง pointer ไปยัง commit ไม่ใช่สำเนา) — ดังนั้นการสร้างและสลับ branch จึงรวดเร็วและประหยัด ซึ่งเป็นเหตุผลที่การใช้ branch ใน Git ถูกใช้กันอย่างมาก
