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
300
Git講習 2014.04.15
Held at UEC
masawada
April 15, 2014
Tweet
Share
More Decks by masawada
See All by masawada
よりよいレビュー環境を求めて / A code review odyssey
masawada
0
2.8k
フロントエンドの秩序は保たれているか?
masawada
0
4k
Getting Started with ScratchX
masawada
0
650
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
C Lecture 2013.09.19
masawada
0
140
Other Decks in Programming
See All in Programming
GrafanaのHTTP API を眺めてみよう
rinchoku
0
130
学生の時に開催したPerl入学式をきっかけにエンジニアが組織に馴染むために勉強会を主催や仲間と参加して職能間の境界を越えていく
ohmori_yusuke
1
130
[KR] Server Driven Compose With Firebase
skydoves
2
200
ビット演算の話 / Let's play with bit operations
kaityo256
PRO
4
180
VS Code extension: ドラッグ&ドロップでファイルを並び替える
ttrace
0
170
実践Dash - 手を抜きながら本気で作るデータApplicationの基本と応用 / Dash for Python and Baseball
shinyorke
2
470
pytest プラグインを開発して DRY に自動テストを書こう
inuatsu
2
260
CSC509 Lecture 03
javiergs
PRO
0
140
自分だけの世界を創るクリエイティブコーディング / Creative Coding: Creating Your Own World
chobishiba
2
1.3k
Competitionsだけじゃない! Kaggle Notebooks Grandmasterのすすめ
corochann
1
340
Removing Corepack
yosuke_furukawa
PRO
9
1.2k
perl for shell, awk and sed programmers
mackee
1
700
Featured
See All Featured
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
GraphQLとの向き合い方2022年版
quramy
43
13k
It's Worth the Effort
3n
183
27k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
504
140k
How To Stay Up To Date on Web Technology
chriscoyier
787
250k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
How GitHub (no longer) Works
holman
311
140k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
355
29k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.7k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.8k
Atom: Resistance is Futile
akmur
261
25k
4 Signs Your Business is Dying
shpigford
180
21k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠