ACS Workshop (github)
Workshop 1
1. สร้างพื้นที่ที่เก็บเวอร์ชันควบคู่และตั้งค่า repository Git ใหม่
git init
2. สร้างไฟล์ใหม่และเพิ่มเนื้อหาบางส่วนลงในไฟล์
สร้างไฟล์ Hello.md
และใส่ข้อความ ชื่อ,อายุ,สิ่งที่ชอบ,ทำไมถึงเข้าคณะนี้
3. ตรวจสอบสถานะของ repo
git status
4. เพิ่มไฟล์ลงในพื้นที่เก็บสำหรับการทำซ้ำ (staging area)
git add Hello.md
5. ทำการคอมมิตต์การเปลี่ยนแปลง
git commit -m "เพิ่มไฟล์ hello.txt"
6. สร้าง new branch
git branch feature
7. เปลี่ยนไปที่ new branch
git checkout feature
8. แก้ไขไฟล์ใน new branch
โดยใส่สิ่งข้อมูลของเพื่อนเข้าไปในไฟล์
9. ทำการคอมมิตต์การเปลี่ยนแปลงใน new branch
git commit -am "เพิ่มฟีเจอร์ใหม่"
10. เปลี่ยนกลับไปที่ main branch
git checkout main
11. ผสานการเปลี่ยนแปลงจาก new branch กับ main branch
git merge feature
12. นำการเปลี่ยนแปลงไปยังรีพอสิทอรีระยะไกล (ของเก็บที่กำหนดที่ GitHub แบบ remote repository)
git remote add origin <repository_url>
git push -u origin main
Workshop 2
ให้แก้โจทย์ที่กำหนด โดยแบ่งข้อละ 1 คน และ ทำการอัพขึ้นบน github
1.โคลน
git clone <forked_repository_url>
เข้า Directory ของ git repocd <repository_name>[path]
2.
code .
สร้าง Branch ชื่อ ว่า feature
git branch fueture
แก้ไขไฟล์ README.md
4.
git add [yourfile].
5.
git commit -am "ใส่ชื่อตัวเอง"
push ไฟล์ที่แก้ไขขึ้น githubgit push -u origin fueture
กลับไปที่ branch main
git checkout main
git add .
git commit -m "ใส่ชื่อของตัวเอง"'Last 6.สร้างcommit'
7.git checkout [main]
8.git merge main
9..git remote add origin [repository]
10.
git push -u origin [yourbranch]main