การใช้งาน Git พื้นฐาน
Technical documentation
31/03/2025
การตั้งค่าผู้ใช้งาน:
git config --global user.name "ชื่อ" และ git config --global user.email "อีเมล"
การเริ่มต้น repository:
git init
การเช็คสถานะ:
git status
การเพิ่มไฟล์ไปยัง staging area:
git add <ชื่อไฟล์> หรือ git add .
การบันทึกการเปลี่ยนแปลง:
git commit -m "ข้อความอธิบาย"
การดูประวัติ commit:
git log
การเชื่อมต่อกับ remote repository:
git remote add origin <URL>
การส่งโค้ดไปยัง remote repository:
git push origin main
การดึงโค้ดจาก remote repository:
git pull origin main
การโคลน repository:
git clone <URL>
การสร้าง branch ใหม่:
git branch <ชื่อ branch>
การสลับไปยัง branch อื่น:
git checkout <ชื่อ branch> หรือ git switch <ชื่อ branch>
การรวม branch:
git merge <ชื่อ branch ที่ต้องการรวม>