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
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
350
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
Security_for_introducing_eBPF
kentatada
0
110
Recoilを剥がしている話
kirik
5
6.6k
Jakarta EE meets AI
ivargrimstad
0
230
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
920
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
3
920
Zoneless Testing
rainerhahnekamp
0
120
Refactor your code - refactor yourself
xosofox
1
260
クリエイティブコーディングとRuby学習 / Creative Coding and Learning Ruby
chobishiba
0
3.9k
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
layerx_20241129.pdf
kyoheig3
2
290
Featured
See All Featured
ReactJS: Keep Simple. Everything can be a component!
pedronauck
665
120k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
A designer walks into a library…
pauljervisheath
204
24k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Become a Pro
speakerdeck
PRO
26
5k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
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
͋Γ͕ͱ͏͍͟͝·ͨ͠