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
Git講習 2014.04.15
Search
masawada
April 15, 2014
Programming
1
310
Git講習 2014.04.15
Held at UEC
masawada
April 15, 2014
Tweet
Share
More Decks by masawada
See All by masawada
10年続くサービスのデータを1日未満のメンテナンスウィンドウで安全に移管する
masawada
5
2.1k
よりよいレビュー環境を求めて / A code review odyssey
masawada
0
2.9k
フロントエンドの秩序は保たれているか?
masawada
1
4.1k
Getting Started with ScratchX
masawada
0
670
GyaPC::Asia Tokyo 2015 LT
masawada
0
1.4k
Privileged Apps with Vue.js
masawada
0
160
Chikubeam
masawada
1
1.5k
Hack U at UEC 2014.03.27
masawada
0
1.5k
Firefox OS勉強会 4th Untitled
masawada
0
1.3k
Other Decks in Programming
See All in Programming
103 Early Hints
sugi_0000
1
240
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
140
php-conference-japan-2024
tasuku43
0
330
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
range over funcの使い道と非同期N+1リゾルバーの夢 / about a range over func
mackee
0
110
Beyond ORM
77web
7
990
Spatial Rendering for Apple Vision Pro
warrenm
0
110
ChatGPT とつくる PHP で OS 実装
memory1994
PRO
2
110
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
バグを見つけた?それAppleに直してもらおう!
uetyo
0
180
Featured
See All Featured
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Designing for humans not robots
tammielis
250
25k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
Java REST API Framework Comparison - PWX 2021
mraible
28
8.3k
It's Worth the Effort
3n
183
28k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
GitHub's CSS Performance
jonrohan
1030
460k
RailsConf 2023
tenderlove
29
940
A Modern Web Designer's Workflow
chriscoyier
693
190k
Building Your Own Lightsaber
phodgson
103
6.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
520
Transcript
Gitߨश 2014.04.15
͜ΜΜ
ߨࢣ հ • masawada • ใཧֶ෦ ใɾ௨৴ֶՊ 3 ίϯϐϡʔλαΠΤϯείʔε •
Θ͔Βͳ͍͜ͱ͕͋Ε
[email protected]
·ͨ @masawada (Twitter) ·Ͱ
ຊͷ͓͠ͳ͕͖ • Gitͱ • جຊతͳίϚϯυ / ߟ͑ํ • GitͷதΛΈͯΈΑ͏
ߨशΛߦ͏ʹ͋ͨͬͯ • ࣮ࡍʹίϚϯυΛଧͪͳ͕Βઆ໌͠·͢ɻ • Մೳͳํ͓खݩͷͰ͓ࢼ͍ͩ͘͠͞ɻ • ࢿྉWebαΠτʹΞοϓϩʔυ͞Ε͍ͯ·͢ɻ
Gitͱ
Gitͱ όʔδϣϯཧγεςϜ (VCS) = มߋཤྺΛه / ཧ͢ΔιϑτΣΞ ! ଞʹSubversionBazzarͳͲ…
ྫ͑ • ϨϙʔτϓϩάϥϜΛॻ͍͍ͯͯ ۠Γͷྑ͍ͱ͜ΖͰอଘ͓͖͍ͯͨ͠ • ·ͱʹॻ͚͍ͯΔ / ಈ͍͍ͯΔঢ়ଶͷͷΛ อଘ͓͍ͯ͠ɺ͕ൃੜͨ͠ͱ͖ʹ ͤΔΑ͏ʹ͍ͨ͠
͍··Ͱͷ มߋཤྺཧ
ϑΝΠϧϕʔε
Excelϕʔε
खಈͰมߋཤྺΛཧ͢ΔͷͰ ਓҝతͳϛε͕ଟ͘ͳΔ ͜ΕΒΛͯ͢ ࣗಈԽ͍ͨ͠
ͱ͍͏ߟ͑ͷͱੜ·Εͨͷ͕ όʔδϣϯཧγεςϜ
ɾҰ࣍ޙظͷجૅϓϩάϥϛϯά͓Αͼԋश → Cݴޠͷॻ͖ํΛֶͿ → มߋཤྺΛཧ͢Δඞཁ͕͋·Γͳ͍ ! ! ɾຊϫʔΫγϣοϓ → ಈ͘ϞϊΛ࡞Δ
→ มߋཤྺΛཧ͢Δඞཁ͕͋Δ
جૅฤ
جૅฤ • ϦϙδτϦ (repository) • ίϛοτ (commit)
ϦϙδτϦͱ σʔλͷมߋཤྺΛཧ͢Δ ாͷΑ͏ͳͷ
ίϛοτͱ ϦϙδτϦʹରͯ͠ มߋཤྺΛՃ͢Δ͜ͱ
ίϛοτ࡞ͷྲྀΕ 1. ϫʔΫπϦʔͰϑΝΠϧΛՃ/มߋ/আ͢Δ 2. ͋Δఔ·ͱ·ͬͨΒΠϯσοΫεʹՃ͢Δ ΠϯσοΫεͱɺػೳ͝ͱͳͲʹ͚ͯίϛοτΛ ࡞ΔͨΊʹมߋͨ͠ϑΝΠϧΛཷΊΔॴ ΠϯσοΫεʹొ͞Ε͍ͯͳ͍ϑΝΠϧίϛοτ͞Εͳ͍ 3. ΠϯσοΫεͷ༰ΛϦϙδτϦʹίϛοτ͢Δ
ϦϙδτϦͱίϛοτ ϫʔΫπϦʔ ΠϯσοΫε ϦϙδτϦ (࡞ۀσΟϨΫτϦ)
ϦϙδτϦͷॳظԽ $ git init
ΠϯσοΫεʹมߋΛొ $ git add [filename] $ git add .
ίϛοτͷ࡞ $ git commit $ git commit -m “message”
ϑΝΠϧͷঢ়ଶΛදࣔ $ git status
มߋཤྺͷදࣔ $ git log
͜͜·ͰΛσϞ
ࠩͷදࣔ $ git diff [old] [new]
͜͜·ͰΛσϞ
ϒϥϯνฤ
ϒϥϯνͱ ࢬ
ϒϥϯνͱ ࢧ෦, ࢧہ
ϒϥϯνͱ • ෳͷػೳΛಉ࣌ʹฒߦͯ͠࡞Ͱ͖Δ • νʔϜ։ൃΛ͢Δͱ͖ʹϒϥϯνΛ࡞Δ͜ͱͰ ଞਓͷมߋʹ໎Λ͔͚ͳ͍Α͏࡞ۀͰ͖Δ • ෆ҆ͳ࡞ۀϒϥϯνΛ࡞͔ͬͯΒߦ͏͜ͱͰ ϒϥϯνΛফ͚ͩ͢Ͱݩͷঢ়ଶʹΕΔ
ϒϥϯνͱ
ϒϥϯνͷ࡞ $ git branch [name]
ϒϥϯνͷΓ͑ $ git checkout [name]
ϒϥϯνͷ࡞ͱΓ͑ $ git checkout -b [name]
ϒϥϯνͷ౷߹ $ git merge [name]
ϒϥϯνͷআ $ git branch -d [name] $ git branch -D
[name] merge͞Ε͍ͯͳ͍ϒϥϯν-DͰফ͢
͜͜·ͰΛσϞ
ϒϥϯνͷڝ߹
ϒϥϯνͷڝ߹ 1. master͔Βfeature_1, feature_2ϒϥϯνΛ࡞ 2. feature_1ϒϥϯνʹػೳΛՃɺίϛοτ͢Δ 3. feature_1ϒϥϯνΛmasterϒϥϯνʹmerge 4. feature_2ϒϥϯνʹػೳΛՃɺίϛοτ͢Δ
5. feature_2ϒϥϯνΛmasterϒϥϯνʹmerge
ϒϥϯνͷڝ߹ master feature_1 feature_2
࣮ࡍʹσϞ
ϦϞʔτϦϙδτϦ
ϦϞʔτϦϙδτϦ • ϦϙδτϦΛαʔόʹόοΫΞοϓ • ϦϙδτϦΛଞਓͱڞ༗Ͱ͖Δ
GitϦϙδτϦ ϗεςΟϯάαʔϏε
ϦϞʔτϦϙδτϦͷొ $ git remote add [name] [url]
ϦϞʔτϦϙδτϦͷऔಘ $ git clone [url]
ϦϞʔτϦϙδτϦͷߋ৽ $ git push $ git push -u [name] [branch]
ϩʔΧϧϦϙδτϦͷߋ৽ $ git pull
͜͜·ͰΛσϞ
ίϛοτͷ औΓফ͠/Γ͠
લͷίϛοτͷΓͳ͓͠ $ git commit --amend ͻͱͭ·͑ͷίϛοτΛΓͳ͓͢
ΠϯσοΫεՃͷऔΓফ͠ $ git reset ΠϯσοΫεʹՃͨ͠ϑΝΠϧͷϦετΛ ΠϯσοΫε͔ΒऔΓআ͘
ίϛοτͷআ $ git reset --hard [commit] ࢦఆͨ͠ίϛοτ·ͰΔ ࢦఆίϛοτ͔Βݱࡏ·ͰͷίϛοτΒͳ͍
ίϛοτͷআ $ git reset --soft [commit] ࢦఆͨ͠ίϛοτ·ͰΔ ϫʔΫπϦʔͷมߋཤྺΔ
ίϛοτͷଧͪফ͠ $ git revert [commit] ࢦఆͨ͠ίϛοτΛଧͪফ͢ίϛοτΛ࡞͢Δ ͦͷίϛοτͰՃͨ͠෦Λͬͦ͝Γআ͢Δ
͜͜·ͰΛσϞ
ͦͷଞͷTips
.gitignore .DS_Store.swpͳͲͷ͍Βͳ͍ϑΝΠϧΛ Ճ͠ͳ͍Α͏ʹͰ͖Δ
͜͜·ͰΛσϞ
࠷ޙʹ
·ͩ·ͩػೳ ͨ͘͞Μ͋Δ
None
͋Γ͕ͱ͏͍͟͝·ͨ͠