Advertisement
julong

github commands

Aug 12th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. 1. git init
  2. เป็นคำสั่งเริ่มต้นใช้งาน git มาควบคุมเวอร์ชั่นของ files และ folders ในตำแหน่งที่อยู่ปัจจุบัน โดยจะสร้าง folder .git ขึ้นมาซึ่งเป็น hidden folder ซึ่ง folder นี้จะเก็บข้อมูลต่างๆ ของ git repository ไว้
  3. 2. git status
  4. เป็นคำสั่งใช้ในการดูว่ามีการเปลี่ยนแปลงเกิดขึ้นหรือไม่
  5. 3. git add <file name>
  6. เป็นคำสั่งการเพิ่ม files หรือ folders ที่สร้างขึ้นมาใหม่เข้าไปยัง git repository
  7. 4. git commit -m '<comment message>'
  8. เป็นคำสั่งเพื่อยืนยัน file ที่มาจากคำสั่ง add เพื่อเข้าไปเก็บใน git repository จริงๆ
  9. 5. git log และ git log --sum­mary
  10. เป็นคำสั่งเพื่อดูประวัติการ commit ต่างๆ ใน git repository
  11. 6. จะให้เราทำการ login เข้าใช้งาน github.com ดังนั้นจำเป้นจะต้องสมัครและทำการ authentication ผ่าน OAuth โดยเป้นการสอนให้รู้จักใช้งาน remote repository นั่นเอง
  12. 7. เมื่อทำการ login เรียบร้อย ทางระบบจะสร้าง repository ชื่อว่า try_git ขึ้นมา
  13. 8. git remot­e add origi­n git@g­ithub.com:<username>/try_gi­t.git
  14. เป็นคำสั่งใช้สำหรับการเพิ่ม remote repository ขึ้นมาชื่อว่า origin เพื่อนำมาใช้งานต่อไป
  15. 9. git push -u origi­n maste­r
  16. เป็นคำสั่งส่ง files และ folders จาก repository ของเราที่ทำการ commit ไว้ ไปยัง remote repository หรือ github.com นั่นเอง
  17. 10. git pull origi­n maste­r
  18. เป็นคำสั่งาำหรับดึง files และ folders ต่างๆ ที่มีการเปลี่ยนแปลงลงมาที่เครื่องของเรา
  19. 11. git diff HEAD
  20. เป็นคำสั่งใช้ตรวจสอบว่ามีการเปลี่ยนแปลงอะไรที่แตกต่างจากสิ่งที่เรา commit ไว้บ้าง
  21. 12. git reset­ <file name>
  22. เป็นคำสั่งสำหรับการยกเลิก stated ของ file ที่เราต้องการออกไป ก่อนที่จะ commit
  23. 13. git branch <branch name>
  24. เป็นคำสั่งสำหรับการสร้าง branch ขึ้นมาใหม่ ซึ่งสร้างเพื่อนำไปใช้งานตามที่เราต้องการ เช่น ทำการแก้ไขส่วนต่างๆ โดยไม่ไปกระทบคนอื่นๆ
  25. 14. git checkout <branch name>
  26. เป็นคำสั่งสำหรับเปลี่ยนการใช้งานไปยัง branch นั้นๆ
  27. 15. git rm <file name>
  28. เป็นคำสั่งสำหรับลบ files และ folders ต่างๆ ออกไปจาก git repository และจาก storage อีกด้วย
  29. 16. git merge <branch name>
  30. เป็นคำสั่งสำหรับการ merge files และ folders จาก <branch name> กับ current branch หรือ master ( จากตัวอย่าง )
  31. 17. git branch -d <branch name>
  32. เป็นคำสั่งสำหรับลบ branch ที่ต้องการ
  33. 18. git push
  34. เป็นคำสั่งสำหรับส่ง files และ folders ที่ commit เรียบร้อยไปยัง remote repository
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement