31 พฤษภาคม 2009มาลอง พัฒนา Application ร่วมกับ Git กันเถอะ (1)

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

is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Every 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.

is used for version control of files, much like tools such as MercurialBazaarSubversionCVSPerforce, andVisual SourceSafe.

อ้างจาก   http://-scm.com/

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

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

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

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

Related Blogs


Tags: ,
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

Comment ไม่ได้กดที่นี่

Get Adobe Flash playerPlugin by wpburn.com wordpress themes