Skip to content

Latest commit

 

History

History
160 lines (110 loc) · 4.06 KB

File metadata and controls

160 lines (110 loc) · 4.06 KB

Git Commands สำหรับอัพโหลดโปรเจค

ขั้นตอนที่ 1: เตรียมโปรเจค

cd C:\Users\dansa\Desktop\AI\MangaTranslator-Browser

# ตรวจสอบสถานะ
git status

ขั้นตอนที่ 2: Initialize Git (ถ้ายังไม่ได้ทำ)

# ถ้ายังไม่มี .git folder
git init

# ตั้งค่า user (ครั้งแรก)
git config user.name "Your Name"
git config user.email "your.email@example.com"

ขั้นตอนที่ 3: Add ไฟล์ทั้งหมด

# Add ทุกไฟล์ (ยกเว้นที่อยู่ใน .gitignore)
git add .

# ดูว่า add อะไรบ้าง
git status

ขั้นตอนที่ 4: Commit

git commit -m "Initial commit: Manga Translator Browser with Detection, OCR, and Multi-Page support"

ขั้นตอนที่ 5: สร้าง Repository บน GitHub

  1. เปิด https://github.com
  2. คลิก New Repository
  3. ตั้งชื่อ: MangaTranslator-Browser
  4. เลือก Public หรือ Private
  5. ไม่ต้อง เลือก Add README, .gitignore (เรามีแล้ว)
  6. คลิก Create Repository

ขั้นตอนที่ 6: Push ขึ้น GitHub

# เพิ่ม remote repository (เปลี่ยน yourusername)
git remote add origin https://github.com/yourusername/MangaTranslator-Browser.git

# Push ขึ้น GitHub
git push -u origin main

# ถ้า Error ว่า branch ชื่อ master
git branch -M main
git push -u origin main

ขั้นตอนที่ 7: ตรวจสอบ

เปิด https://github.com/yourusername/MangaTranslator-Browser ควรเห็นไฟล์ทั้งหมดแล้ว!


คำสั่งเพิ่มเติม

ถ้าต้องการแก้ไขและ push อีกครั้ง:

# ดูว่ามีไฟล์อะไรเปลี่ยน
git status

# Add ไฟล์ที่แก้
git add .

# Commit
git commit -m "Add Settings Panel feature"

# Push
git push

ถ้าต้องการดู history:

git log --oneline

ถ้าต้องการสร้าง branch ใหม่:

# สร้าง branch สำหรับ feature ใหม่
git checkout -b feature/new-feature

# แก้ไขโค้ด...

# Push branch ใหม่
git push -u origin feature/new-feature

ถ้าต้องการ undo การ commit:

# Undo commit ล่าสุด (แต่เก็บการแก้ไข)
git reset --soft HEAD~1

# Undo ทุกอย่าง (ระวัง!)
git reset --hard HEAD~1

🚨 Important Notes

  1. ไฟล์ที่ไม่ควร commit:

    • node_modules/ (ใหญ่มาก)
    • venv/ (Python virtual env)
    • .env (มี secrets)
    • backend/uploads/ (ไฟล์ผู้ใช้)
    • backend/models/*.onnx (model ใหญ่)
  2. ไฟล์เหล่านี้อยู่ใน .gitignore แล้ว

  3. Model file (detector.onnx):

    • ถ้าต้องการแชร์ model ให้ user download แยก
    • Or ใช้ Git LFS (Large File Storage)
  4. Sensitive data:

    • ตรวจสอบว่าไม่มี API keys, passwords ใน code
    • ใช้ .env file แทน (อยู่ใน .gitignore)

📦 Git LFS (สำหรับไฟล์ใหญ่)

ถ้าต้องการ commit model file (.onnx):

# ติดตั้ง Git LFS
git lfs install

# Track ไฟล์ใหญ่
git lfs track "*.onnx"

# Add .gitattributes
git add .gitattributes

# Add model file
git add backend/models/detector.onnx

# Commit & Push
git commit -m "Add ONNX model with Git LFS"
git push

หมายเหตุ: GitHub Free มี LFS quota 1GB/month