Skip to content

ใช้ Git Tools อะไรดี

  • ใช้ source control ใน IDE เลย
  • ใช้ gitui กรณีใช้ผ่าน terminal
  • ใช้ gitbutler ในกรณีที่ต้องการการจัดการที่ดีขึ้น ง่ายขึ้น

คำแนะนำเมื่อเริ่มต้น Git

1. git init (สร้าง repo ใหม่)

sh
git init

file ต่างๆจะถูก track

source control จะประกฏ

2. เขียน .gitignore ละเว้นไฟล์ไม่ให้ track

เขียนไฟล์ที่ไม่ต้องการให้ git track ใน .gitignore

จากภาพไฟล์ที่ถูก ignore จะขึ้นสีอ่อนๆ

3. gh repo create (สร้าง github repo รอและเชื่อมให้เรียบร้อย)

ติดตั้ง github.com favicongithub cli ก่อน และ cli.github.com favicongh auth login ให้เรียบร้อย

4. แก้ไขไปสักพัก เริ่ม commit

แก้ไขไปสักพัก แล้ว commit และพยายาม commit เรื่อยๆเสมอๆ

แนะนำใช้ github.com faviconaicommits หรือ cz-git.qbb.sh faviconczg เพื่อให้ ai ช่วย commit และเพื่อมีประสิทธิภาพในการทำงานที่ดีขึ้น

sh
git add .                        # เพิ่มไฟล์เข้า staging area
git commit -m "Initial commit"   # commit ไฟล์

5. หากพร้อมแล้ว push ขึ้น github

แนะนำใช้ githooks เช่น github.com faviconlefthooks เพื่อทำให้ workflow ดีขึ้น เช่น ก่อน commit ควร run install, run lint ก่อน หรือก่อน push ควร run build, run test ก่อน