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
2k
よりよいレビュー環境を求めて / A code review odyssey
masawada
0
2.8k
フロントエンドの秩序は保たれているか?
masawada
1
4.1k
Getting Started with ScratchX
masawada
0
660
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.2k
Other Decks in Programming
See All in Programming
Amazon Qを使ってIaCを触ろう!
maruto
0
420
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.8k
Click-free releases & the making of a CLI app
oheyadam
2
120
カンファレンスの「アレ」Webでなんとかしませんか? / Conference “thing” Why don't you do something about it on the Web?
dero1to
1
110
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
200
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
1k
Better Code Design in PHP
afilina
PRO
0
130
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
360
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
260
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
170
Duckdb-Wasmでローカルダッシュボードを作ってみた
nkforwork
0
130
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
430
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Bash Introduction
62gerente
608
210k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Agile that works and the tools we love
rasmusluckow
327
21k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠