มาลอง พัฒนา Application ร่วมกับ Git กันเถอะ (1)

คืออะไร ? ว่าง่ายๆ ก็คือ opensource  ที่ใช้เป็น version control system นั่นแหละครับ หรือ นิยามเต็มๆ ก็คือ

Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.Branching and merging are fast and easy to do. Git is used for version control of files, much like tools such as MercurialBazaarSubversionCVSPerforce, andVisual SourceSafe. อ้างจาก   http://git-scm.com/

พอพูดถึงนิยามไปแล้ว เรามาลองใช้ git กันเลยดีกว่า

  1. เราต้องติดตั้ง git ก่อน (Download and install Git )
  2. ทดลองสร้าง Directory หรือไฟล์ ดังนี้ $ mkdir ProjectName $ cd ProjectName $ touch README
  3. สั่ง git init  เพื่อสร้าง repository $ git init
  4. เมื่อสร้างไฟล์ใดๆแล้วให้สั่ง git add ชื่อไฟล์ หรือถ้าต้องการ add ทั้งหมดก็สั่ง git add . ได้เลย $ git add .
  5. เมื่อทำอะไรเรียบร้อยแล้วก็ต้องยืนยันการกระทำโดยสั่ง git commit -m ‘COMMENT’ $ git commit -m ‘First Commit README added)
  6. ถ้าต้องการสร้าง branch ใหม่ก็สั่ง git branch branchname $ git branch newbranch
  7. ต้องการ switch branch ก็สั่ง git check branchname $ git checkout newbranch $ git branch

ตามไปดู ตัวอย่างการใช้งานจริงได้ที่  VDO การพัฒนา Grails application ร่วมกับ Git เพื่อเพิ่ม productivity ก็ได้คร้าบบ

คราวหน้ามาพูดถึง github กันครับ

เรื่องที่เกี่ยวข้อง

ใส่ความเห็น

อีเมล์ของคุณจะไม่แสดงให้คนอื่นเห็น ช่องที่ต้องการถูกทำเครื่องหมาย *

*

คุณอาจจะใช้ป้ายกำกับและคุณสมบัติHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>