Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Day 1 - Git
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
offz
April 19, 2017
Programming
96
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Day 1 - Git
Show how to use git for beginner.
offz
April 19, 2017
More Decks by offz
See All by offz
TM-P2-IT-security
offfffz
0
29
Docker Compose for Rails Developer
offfffz
1
39
Day 2 - Docker
offfffz
0
49
Day 2 - CI
offfffz
0
69
Day 1 - Testing
offfffz
0
63
Other Decks in Programming
See All in Programming
思考垂れ流し開発 ~音声入力 × AIエージェント × 開発ハーネスによる試行錯誤~
npostring
0
810
FDEとは、何者なのか?
masapyon1212
0
130
이 함수, 실패하면 어떻게 되나요? null부터 Rich Errors까지, Kotlin 에러 처리 15년
haeti2
0
120
AI駆動開発にグラフDBを重ねてみた
satoshi256kbyte
2
720
Gmail/Google DriveをトリガーにAIエージェントを動かそう! / Run AI agents with Gmail/Google Drive as triggers!
har1101
3
460
20260828_品質と開発生産性を両立させる、AI時代のE2Eテストの考え方
magicpod
0
130
FastAPI の並行処理モデルを完全に理解する
hoto17296
9
3.7k
T3DD26: From RAGs to Riches
martinhelmich
0
140
ハーネス設計入門 〜プロンプト、コンテキストの次〜
kinopeee
53
34k
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
130
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
130
Deep dive into the select statement (GopherCon UK)
jespino
0
170
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
9
970
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
370
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
180
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
410
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
490
Designing for Performance
lara
611
70k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.1k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.3k
Color Theory Basics | Prateek | Gurzu
gurzu
0
450
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
500
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
510
Transcript
Git
Git คือ? Master Dev new awesome feature
Keywords - commit: snapshot งานของเรา ณ. เวลานั้นๆ - branch: pointer
ที่ชี้ไปที่ commit 1 จุด - checkout: เปลี่ยน branch - merge: นำ 2 branch มารวมกัน
Keywords - clone: นำ code จากบน server ลงมา - push:
ส่งงานจากเครื่อง ขึ้นไปที่ server - fetch: download งานล่าสุดจาก server - pull: fetch + merge
Commit สถานะปัจจุบัน ของงานที่กำลังทำอยู่
Commit a.txt ——————————— Hello a.txt ——————————— Hello World B
A
Branch ให้มองเป็น pointer ที่ชี้ไปที่ commit ใดๆ ใน graph
Branch B A C D Master Dev
Branch B A C D Master Dev E
Branch B A C D Master Dev E F
Checkout เปลี่ยน pointer ที่เรากำลังทำงาน ไปที่ commit อื่น
Checkout B A Master a.txt ——————————— Hello a.txt ——————————— Hello
World B A Master
Merge นำ 2 branch มารวมกัน โดยต้องไม่มี จุดที่เปลี่ยนแปลงพร้อมกัน ทั้งสอง branch
Merge B A Master a.txt ——————————— Hello World Dev
Merge B A Dev a.txt ——————————— Hello World Master
C
Merge (conflict) นำ 2 branch มารวมกัน แต่มีจุดที่แก้ไข ณ. ที่เดียวกันทั้งสอง
branch
Merge (conflict) B A Master a.txt ——————————— Hello World
Dev
Merge (conflict) B A Master a.txt (Dev) ——————————— Hello
Thailand Dev C a.txt (Master) ——————————— Hello World
Merge (conflict) B A a.txt (Dev) ——————————— Hello Thailand
C a.txt (Master) ——————————— Hello World E Dev Master a.txt (conflict) ——————————— Hello >>>>>>> World ======= Thailand <<<<<<<
Merge (conflict) B A C Dev Master E a.txt (Dev)
——————————— Hello World a.txt (Master) ——————————— Hello World
Clone สร้าง directory ใหม่ในเครื่องของเรา แล้วทำการ download ทุกอย่างลงมา
Server Clone B A C D Master Dev E เครื่องเรา
B A C D Master Dev E
Push ส่งงานที่เราทำขึ้นไปบน server
Server Push B A C D Master Dev E เครื่องเรา
B A C D Master Dev E F
Server Push B A C D Master Dev E เครื่องเรา
B A C D Master Dev E F F
Fetch download งานใหม่ที่สุดลงมาในเครื่องเรา
Server Fetch B A C D Master Dev E เครื่องเรา
B A C D Master Dev E F
Server Fetch B A C D Master Dev E เครื่องเรา
B A C D Master Dev E F F
Pull fetch งานล่าสุดจาก server และ merge เข้ากับงานล่าสุดในเครื่องเรา
Server Pull B A C D Master Dev E เครื่องเรา
B A C D Master Dev E F
Server Pull B A C D Master Dev E เครื่องเรา
B A C D Master Dev E F F
Git ดียังไง - ไม่มี internet ก็ทำงานได้ - ไม่ถูกรบกวนจากการเปลี่ยนแปลงที่คนอื่นทำ ในขณะที่เราทำงาน
- เมื่อส่งขึ้น server แล้วมั่นใจได้ว่างานจะไม่หาย
ไม่ต้องต่อ internet ตลอด Server B A C D Master E
เครื่องเรา B A C D Master Dev E F G Dev
ไม่ถูกงานคนอื่นรบกวน Server B A C D Master E เครื่องเรา B
A C D Master Dev E ก ข G F Dev
งานไม่หาย Server B A C D Master E เครื่องเรา B
A C D Master Dev E ก ข G F Dev G F Origin/Dev H H
ทำงานกับ Git - pull ของใหม่บ่อยๆ - จะเริ่มงานใหม่ ให้แตก branch -
ทำงาน feature เล็กๆ เสร็จแล้วก็ commit - push ขึ้น server บ่อยๆ ป้องกันงานหาย - งานเสร็จแล้ว ให้ merge กลับไปที่ branch หลัก
Git Server
Gitlab
ข้อดีของ Gitlab - open source และ ฟรี - host เอง
ทุกอย่างอยู่ภายใต้การควบคุม - มี CI/CD ในตัวเลย และเป็น code base CI ซึ่งจัดการได้ง่ายมาก
ข้อเสียของ Gitlab ต้องมีคนดูแล ❤
ทำงานกับ Gitlab 1. สร้าง issue 2. สร้าง branch จาก issue
3. ใช้คำสั่ง git fetch และ git checkout <branch_name> 4. เมื่องานเสร็จให้ push ขึ้นไปที่ server 5. เปิด merge request
ได้เวลามือเปื้อนดิน
walkthrough 00 1. register Gitlab 2. สร้าง ssh key 3.
setup ssh key ใน gitlab
walkthrough 01 1. สร้าง project <name>/git_introduction 2. clone project 3.
สร้างไฟล์ README.md 4. commit 5. push ไป master
walkthrough 02 1. clone project git_first_time 2. สร้าง issue 3.
สร้าง branch จาก issue และสร้าง Merge Request 4. ใช้คำสั่ง git fetch และ git checkout <branch_name>
exercise 1 1. สร้าง folder เป็นชื่อของตัวเองที่จะไม่ซ้ำกับคนอื่น 2. สร้าง file README.md
ใน folder นั้น 3. เขียน markdown ตามต้องการ 4. commit เรื่อยๆ และ push ขึ้น server เป็นครั้งคราว 5. เมื่อทำงานเสร็จแล้ว ให้เอา WIP: ออก
exercise 2 1. สร้าง folder ชื่อ shared 2. สร้าง file
<[1-10]>.md ใน folder นั้น 3. เขียน markdown ตามต้องการ 4. commit เรื่อยๆ และ push ขึ้น server เป็นครั้งคราว 5. พยายามทำให้ merge request เป็นสีเขียว