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
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
初めてDefinitelyTypedにPRを出した話
syumai
0
400
Remix on Hono on Cloudflare Workers
yusukebe
1
280
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
2
660
as(型アサーション)を書く前にできること
marokanatani
9
2.6k
Quine, Polyglot, 良いコード
qnighy
4
640
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
520
Jakarta EE meets AI
ivargrimstad
0
120
Arm移行タイムアタック
qnighy
0
300
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Designing Experiences People Love
moore
138
23k
Designing for humans not robots
tammielis
250
25k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
740
Code Reviewing Like a Champion
maltzj
520
39k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Making Projects Easy
brettharned
115
5.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠