TurterDev.com
  • Welcome
  • พื้นฐานคำสั่ง Linux Command
    • Linux Command
    • Linux Command (ต่อ)
    • ใช้งาน VI และ VIM
    • Shell script
    • Vagrant
  • การเขียนโปรแกรมเชิงวัตถุ OOP
    • การเขียนโปรแกรมเชิงวัตถุ
      • เริ่มต้นเขียนโปรแกรมเชิงวัตถุด้วย Javascript
  • Git
    • คำสั่งสำหรับใช้งาน Git
    • Branch,Merge,Stash
    • Remote Repository
  • คำสั่งใช้งาน Docker
    • 🐳Docker
      • Docker Command
  • Kubernetes
    • Kubernetes (K8s)
      • Install Cilium on kubernetes (เปลี่ยนจาก Calico เป็น Cilium บน K8s)
      • Install Kubernetes on Ubuntu 24.04 LTS (Kube-VIP)
      • How to Install Kubernetes Cluster on CentOS 7
  • Etc
    • Kubernetes (K8s)
      • สรุปการพัฒนา Application แบบ The Twelve-Factor แบบสั้นๆง่ายๆ
  • Website
  • Facebook
  • Instagram
Powered by GitBook
On this page
  1. Git

คำสั่งสำหรับใช้งาน Git

คำสั่งสำหรับการตั้งค่าเริ่มต้น

git config --global user.email "example@mail.com"
git config --global user.name "Your Name"

//ตั้งค่า Default branch 
git config --global init.defaultBranch main

//ตรวจสอบค่า Config
git config --list

คำสั่งพื้นฐาน

// คำสั่งสร้าง Repository
git init

//คำสั่งสำหรับ Add file ทั้งหมด
git add .

//คำสั่งสำหรับ save เก็บที่ local repository
git commit -m "ชื่อของการทำงาน"
//คำสั่งสำหรับดู history หรือประวัติการ commit ของ repository
git log

//คำสั่งสำหรับดูสถานะของ repository
git status

//คำสั่งสำหรับการย้อนกลับโค้ดที่เคยเขียนไว้
git restore <ชื่อไฟล์>

//คำสั่งสำหรับเปรียบเทียบ การเปลี่ยนแปลงของไฟล์ที่ได้แก้ไข
git diff

คำสั่งยกเลิกสิ่งที่เคย commit

// ย้อนกลับการเปลี่ยนแปลง และกลับไปยัง working directory (โค้ดเดิมไม่หาย)
git reset --mixed <commit>

//ย้อนกลับการเปลี่ยนแปลง และกลับมายัง Staged (โค้ดเดิมไม่หาย)
git reset --soft <commit>

//ย้อนกลับการเปลี่ยนแปลงพร้อมทั้งลบโค้ดเดิมที่เคยเขียนไว้ รวมถึงการ commit
git reset --hard <commit>

Previousเริ่มต้นเขียนโปรแกรมเชิงวัตถุด้วย JavascriptNextBranch,Merge,Stash

Last updated 1 year ago