Skip to main content

ACS Workshop (github)

Workshop 1

1. สร้างพื้นที่ที่เก็บเวอร์ชันควบคู่และตั้งค่า repository Git ใหม่
git init

2. สร้างไฟล์ใหม่และเพิ่มเนื้อหาบางส่วนลงในไฟล์
echo "สวัสดีครับ นี่คือเวิร์กชอปของ Git!" > hello.txt

3. ตรวจสอบสถานะของ repo
git status

4. เพิ่มไฟล์ลงในพื้นที่เก็บสำหรับการทำซ้ำ (staging area)
git add hello.txt

5. ทำการคอมมิตต์การเปลี่ยนแปลง
git commit -m "เพิ่มไฟล์ hello.txt"

6. สร้างกิ่งใหม่
git branch feature

7. เปลี่ยนไปที่กิ่งใหม่
git checkout feature

8. แก้ไขไฟล์ในกิ่งใหม่
echo "นี่คือฟีเจอร์ใหม่!" >> hello.txt

9. ทำการคอมมิตต์การเปลี่ยนแปลงใน new branch
git commit -am "เพิ่มฟีเจอร์ใหม่"

10. เปลี่ยนกลับไปที่กิ่งหลัก
git checkout main

11. ผสานการเปลี่ยนแปลงจากกิ่งใหม่กับกิ่งหลัก
git merge feature

12. นำการเปลี่ยนแปลงไปยังรีพอสิทอรีระยะไกล (ของเก็บที่กำหนดที่ GitHub แบบ remote repository)
git remote add origin <repository_url>
git push -u origin main

Workshop 2

ให้แก้โจทย์ที่กำหนด โดยแบ่งข้อละ 1 คน และ ทำการอัพขึ้นบน github

1.โคลน (clone) repository ดังนี้
git clone <forked_repository_url>
cd <repository_name>

2. แก้ไขโจทย์ของตัวเอง

3. git init 

4.git add [yourfile]

5.git commit -m "ใส่ชื่อของตัวเอง"

6.สร้าง branch ของตัวเอง

7.git checkout [main]

8.git merge main 

9..git remote add origin [repository]

10.git push origin [yourbranch]