วันอาทิตย์ที่ 7 กุมภาพันธ์ พ.ศ. 2559

Test-Driven Development with Python Chapter 1 (Continued)

ต่อจากคราวที่แล้ว Chapter 1 เรายังไม่จบ

ลองใช้ git (เป็น Version Control System ตัวหนึ่ง)

ย้ายไฟล์ functional_test.py เข้าไปใน /superlists





cd เข้าไปใน /superlists และสร้าง git repository

$ git init .

จากนั้น เราจะทำการ commit

แต่เราไม่ต้องการให้ commit database ไปด้วย จึงใช้คำสั่ง

$ echo "db.sqlite3" >> .gitignore

และ add file ทั้งหมดใน /superlists ลง git repository

$ git add .

และเช็คว่าทำการ add file อะไรไปบ้าง

$ git status


จากนั้น เขาให้ลบไฟล์ .pyc เพราะมันไม่มีประโยชน์ที่จะ commit และ ทำการ ignore

$ git rm -r --cached superlists/__pycache__
$ echo "__pycache__" >> .gitignore
$ echo "*.pyc" >> .gitignore


และทำการ commit

** ก่อน commit ให้ $ git config --global user.email "you@example.com" และ $ git config --global user.name "Your Name" เพื่อเซ็ต email และชื่อ **




ไม่มีความคิดเห็น:

แสดงความคิดเห็น