ACS Workshop (github)
Workshop 1
Merge file and push
git init
git config --global user.name "John Doe"
git config --global user.email "[email protected]"
3.
echo "นี่คือเนื้อหาในไฟล์ readme.md" >> readme.md
4.เพิ่มการเปลี่ยนแปลงในไฟล์ไปยัง staging area เพื่อทำการ commit
git add .
5.ทำการ commit การเปลี่ยนแปลงพร้อมข้อความอธิบาย
git commit -m "คอมมิตต์เริ่มต้น:first เพิ่มไฟล์commit"
6.ทำการ push การเปลี่ยนแปลงไปยัง remote repository (คาดว่าคุณได้ตั้งค่า remote แล้วและให้ชื่อว่า "origin")
git push origin main
7.สร้าง branch ใหม่ชื่อ "feature"
git branch feature
8.สลับไปที่ branch "feature"
git checkout feature
9.ทำการเพิ่มการเปลี่ยนแปลงเพิ่มเติมในไฟล์ "readme.md"
echo "นี่เป็นการแก้ไขเพิ่มเติมในไฟล์ readme.md" >> readme.mdm
10.เพิ่มการเปลี่ยนแปลงเพิ่มเติมในไฟล์ไปยัง staging area
git add .
11.ทำการ commit การเปลี่ยนแปลง
git commit -m "อัปเดตไฟล์second readme.mdcommit"
12.ทำการ push branch "feature" ไปยัง remote repository
git push origin feature
13.สลับกลับมาที่ branch "main"
git checkout main
14.รวมการเปลี่ยนแปลงจาก branch "feature" กลับเข้าสู่ branch "main"
git merge feature
15.ทำการเปลี่ยนแปลงเพิ่มเติมในโค้ดของ branch "main" หากต้องการ
echo "นี่คือการเปลี่ยนแปลงเพิ่มเติมใน branch main." >> main_changes.txt
16.เพิ่มการเปลี่ยนแปลงเพิ่มเติมในโค้ดไปยัง staging area
git add . 19.
17.ทำการ commit การเปลี่ยนแปลง
git commit -m "การเปลี่ยนแปลงบางส่วนในthird branchcommit"
18.ทำการ push การเปลี่ยนแปลงใน branch "main" ไปยัง remote repository
git push origin main
Workshop 2
ให้แก้โจทย์ที่กำหนด โดยแบ่งข้อละ 1 คน และ ทำการอัพขึ้นบน github
- Clone git repo
git clone urlrepo - เข้า Directory ของ git repo
cd [path] - เปิดไฟล์ README.md ด้วย Vscode
code . - สร้าง Branch ชื่อ ว่า feature
git branch fueture - แก้ไขไฟล์ README.md
-
git add . -
git commit -am "ใส่ชื่อตัวเอง" - push ไฟล์ที่แก้ไขขึ้น github
git push -u origin fueture - กลับไปที่ branch main
git checkout main - ทำการ merge
git merge fueture -
git add . -
git commit -m 'Last commit' -
git push -u origin main