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/GitHub入門-GitHubでたのしいチーム開発
Search
Yuta Totz
August 24, 2015
Programming
0
290
Git/GitHub入門-GitHubでたのしいチーム開発
岡山大学テクノロジーラボ(OTL)のGitとGitHubについての入門ワークショップのときのスライドです。
Yuta Totz
August 24, 2015
Tweet
Share
More Decks by Yuta Totz
See All by Yuta Totz
ウガンダでXcodeをアップデートする方法
totzyuta
0
110
Working with UNIX Process 6/7 Chapter
totzyuta
1
60
珈琲と僕
totzyuta
0
89
読んで理解するActiveRecordの設計とActiveSupport::Concern
totzyuta
4
1.5k
TDDとVimと
totzyuta
1
480
モテる!筋肉コンパイラ自作入門 - 草食男子からの卒業
totzyuta
0
420
Vimmer幼稚園
totzyuta
2
110
たのしいたーみなる
totzyuta
0
40
Other Decks in Programming
See All in Programming
Go の GC の不得意な部分を克服したい
taiyow
3
790
Beyond ORM
77web
7
860
php-conference-japan-2024
tasuku43
0
300
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
MCP with Cloudflare Workers
yusukebe
2
220
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
780
快速入門可觀測性
blueswen
0
370
テストコード書いてみませんか?
onopon
2
120
PHPUnitしか使ってこなかった 一般PHPerがPestに乗り換えた実録
mashirou1234
0
200
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
130
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
Effective Signals in Angular 19+: Rules and Helpers @ngbe2024
manfredsteyer
PRO
0
140
Featured
See All Featured
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
For a Future-Friendly Web
brad_frost
175
9.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Docker and Python
trallard
42
3.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Agile that works and the tools we love
rasmusluckow
328
21k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Optimizing for Happiness
mojombo
376
70k
Building Flexible Design Systems
yeseniaperezcruz
327
38k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Transcript
Git/GitHub ೖ GitHubͰͨͷ͍͠νʔϜ։ൃ
ຊͷΰʔϧ
- Gitͨͷ͍͠ʂ - GitHubͰνʔϜ։ൃؾ͍࣋ͪʂ
git
git ͬͯͳΜΖ͔…
ࢄόʔδϣϯཧγεςϜ …Α͚͍Θ͔ΒΜ
ཁ͢Δͱ ࢄ ͯ͠ɺ όʔδϣϯ Λ ཧ͢Δ γεςϜ ͷ͜ͱ
ʮόʔδϣϯཧʯͬͯ…ʁ
ීஈͬͯΔ͜ͱ
ීஈͬͯΔ͜ͱ ϝϞ.txt ϝϞ ID: hoge
ϝϞ.txt ϝϞ ID: hoge ීஈͬͯΔ͜ͱ ϝϞ.txt ϝϞ ID: hoge2015 ฤूதʜ
ීஈͬͯΔ͜ͱ ϝϞ.txt ϝϞ ID: hoge ϝϞ.txt ϝϞ ID: hoge2015 ηʔϒʂʂ
ීஈͬͯΔ͜ͱ ϝϞ.txt ϝϞ ID: hoge ϝϞ.txt ϝϞ ID: hoge2015 ؒҧ͑ͯͨʂʂ
͍͚ͨ͠Ͳ্ॻ͖ͯ͠Μ͡ΌΜʂʂʂ
όʔδϣϯΛཧ͍ͨ͠ͱ͖ɺ Ͳ͏͠·͔͢ʁ …Α͚͍Θ͔ΒΜ
ίϐʔͯ͠όοΫΞοϓΛ ͱ͓ͬͯ͘ Ҋͦͷ̍
ίϐʔΛͱ͓ͬͯ͘ ࠷৽൛index.html index.html (લͷͭ) index-old.html index20510620.html ฤू༻index.html index.html
None
ʮόʔδϣϯཧʯͱ
ηʔϒ͢Δͨͼʹɺ όʔδϣϯΛৼΓ·͢
ʮόʔδϣϯཧʯͱ… ϝϞ.txt มߋ͠·ͨ͠ʂ ϝϞ.txt ηʔϒ͠·ͨ͠ʂ ver. 2 ver. 1
ʮόʔδϣϯཧʯͱ… ϝϞ.txt ϝϞ.txt ͍ؒҧ͑ͯͨʂ ্͔͠ॻ͖ͪ͠Όͬ ͨΑʔʂʂ ver. 2 ver. 1
ͦΜͳͱ͖ʹgitͳΒ ϝϞ.txt Ұݸલʹηʔϒͨ͠ ͱ͜Ζ(ver.1)ʹΔʂ ϝϞ.txt ͜ΕͰ҆৺ʂศརʂ ver. 2 ver. 1
ͯ͢ͷมߋཤྺΛཧͰ͖Δ gitͷ͍͍ͱ͜Ζͦͷ̍
gitͷ͜ͱ • ηʔϒ = ίϛοτ (commit) • ϦϙδτϦ = ϑΥϧμ
gitͷ͘͠Έ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit
merge ࣗͷ1$ͷத push fetch
ΈΜͳ͕ΈΜͳͷPCͰ ωοτͳͯ͘࡞ۀͰ͖Δ gitͷ͍͍ͱ͜Ζͦͷ̎
͜ΕͰgit͑Δʂ
$ git add FILENAME $ git commit -m “message” $
git push 1. εςʔδϯάɾΤϦΞʹՃ 2. ϩʔΧϧͰมߋΛηʔϒ 3. ϩʔΧϧͷηʔϒΛϦϞʔτʹηʔϒ
$ git add FILENAME $ git commit -m “message” 1.
εςʔδϯάɾΤϦΞʹՃ 2. ϩʔΧϧͰมߋΛηʔϒ
$ git add/commit ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM
TUZMFDTT add/commit ࣗͷ1$ͷத
$ git add FILENAME $ git commit -m “message” $
git push 1. εςʔδϯάɾΤϦΞʹՃ 2. ϩʔΧϧͰมߋΛηʔϒ 3. ϩʔΧϧͷηʔϒΛϦϞʔτʹηʔϒ
$ git push 3. ϩʔΧϧͷηʔϒΛϦϞʔτʹηʔϒ
$ git push ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM
TUZMFDTT ࣗͷ1$ͷத push
GitHubͱ
None
GitHubɺ GitͷϦϙδτϦ ΛϗεςΟϯά͢ΔαʔϏε
gitͷ͘͠Έ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit
merge ࣗͷ1$ͷத push fetch (JU)VC
None
νʔϜ։ൃͲ͏Μͷ
νʔϜ։ൃͷΓ͔ͨ τπΧͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ (GitHub͕ϗετ) JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT
commit merge fetch push
൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖
൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖ τπΧͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge
fetch push ൴ঁͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge fetch push ϦϞʔτϦϙδτϦ (GitHub͕ϗετ)
ϦϞʔτϦϙδτϦ (GitHub͕ϗετ) ൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖ τπΧͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT
commit merge fetch push ൴ঁͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge fetch push ͜Ε͕ࢄʂʂʂ
νʔϜ։ൃϑϩʔ
νʔϜ։ൃϑϩʔ • ࣗͷΞΧϯτʹσʔλΛෳ (fork) • ϩʔΧϧ(ࣗͷPCͷத)ʹσʔλΛ࣋ͬͯ͘Δ (clone) • ฤू͢Δ •
มߋ༰Λίϛοτ(ηʔϒ)͢Δ (add/commit) • ίϛοτ༰ΛϦϞʔτ(GitHub্ͷιʔε)ʹө͢Δ (push) • Pull RequestΛͩ͢ (GitHubͷը໘͔Βʂ)
1. ෳ͢Δ (fork) ฤू͍ͨ͠σʔλͷෳΛࣗͷ GitHubͷΞΧϯτʹͭ͘Ε·͢ GitHubͷϖʔδ͔Βʂʂ
1. ෳ͢Δ (fork) ϩʔΧϧϦϙδτϦ ϦϞʔτϦϙδτϦ ࣗͷ1$ͷத (JU)VC ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT
ΦϦδφϧ
1. ෳ͢Δ (fork) ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ ࣗͷ1$ͷத fork (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧ
$ git clone https://github… 2. ࣗͷPCʹ࣋ͬͯ͘Δ (clone) ϦϞʔτ(GitHub)͔Β ϩʔΧϧ(ࣗͷCP)ʹσʔλΛ͖࣋ͬͯ·͢ *
URLGitHubͷϖʔδ͔Βίϐϖ͠·͢
2. ࣗͷPCʹ࣋ͬͯ͘Δ (clone) ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ ࣗͷ1$ͷத (JU)VC ࣗͷΞΧϯτ
JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ
2. ࣗͷPCʹ࣋ͬͯ͘Δ (clone) ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத
clone (JU)VC ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
3. ฤू͢Δ
3. ฤू͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
3. ฤू͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT ฤूͨͬͨ͠ʂʂʂʂ
$ git commit -m “message” 4. ίϛοτ(ηʔϒ)͢Δ ϩʔΧϧʢࣗͷPCͷதʣͰ มߋ༰Ληʔϒʂ $
git add FILENAME commit(ηʔϒ)͢ΔϑΝΠϧΛબͿ
4. ίϛοτ(ηʔϒ)͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
4. ίϛοτ(ηʔϒ)͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT add /
commit ࣗͷ1$ͷத (JU)VC ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
$ git push 5. ϦϞʔτʹө͢Δ (push) ϩʔΧϧʢࣗͷPCʣͷதͷมߋΛ ϦϞʔτʢGitHub্ʣͷιʔεʹө͠·͢
5. ϦϞʔτʹө͢Δʢpushʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
5. ϦϞʔτʹө͢Δʢpushʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT push
GitHubͷϖʔδ͔Βʂʂ 6. มߋΛऔΓࠐΜͰΒ͏ ʢpull requestʣ ΦϦδφϧͷϨϙδτϦʹ ʮͷมߋΛऔΓࠐΜͰ͘Εʂʯ ͱϦΫΤετ͠·͢
5. มߋΛऔΓࠐΜͰΒ͏ʢpull requestʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத
(JU)VC ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
5. ϦϞʔτʹө͢Δʢpushʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT PR มߋ͔ͨ͠Βऔ ΓࠐΜͰΑʔʂʂ
5. ϦϞʔτʹө͢Δʢpushʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத (JU)VC
ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT PR มߋ͔ͨ͠Βऔ ΓࠐΜͰΑʔʂʂ 0,
0. ΈΜͳͷมߋΛऔΓࠐΉ $ git pull upstream master ΦϦδφϧͷํͷϦϞʔτʢGitHub্ʣ͕มߋ͞Ε ͍ͯͨΒ࠷৽൛ΛࣗͷιʔεʹऔΓࠐΉ $
git remote add upstream https:// github.com/okadai-techlab/okayama-u- techlab.com.git ͯ͘Β΅ͷΦϦδφϧͷํϦϞʔτઌͱͯ͠ొ͢Δ * ొ࠷ॳͷҰճ͚ͩͰ͍͍Αʂ ‘upstrem’໊ͬͯલ͡Όͳ͍͍ͯ͘Αʂ
5. มߋΛऔΓࠐΜͰΒ͏ʢpull requestʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத
(JU)VC ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ upstream JOEFYIUNM TUZMFDTT ୭͔͕มߋͨ͠ ʢ࠷৽൛ʣ ෳ origin
5. มߋΛऔΓࠐΜͰΒ͏ʢpull requestʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗͷ1$ͷத
(JU)VC ࣗͷΞΧϯτ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT pull ΦϦδφϧʢຊମʣ upstream ෳ origin
൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖ τπΧͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge
push ൴ঁͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge pull push ϦϞʔτϦϙδτϦ (GitHub͕ϗετ) upstream JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT push pull push PR PR ෳ origin
νʔϜ։ൃϑϩʔ • ࣗͷΞΧϯτʹσʔλΛෳ (fork) … 1ճ͚ͩ • ϩʔΧϧ(ࣗͷPCͷத)ʹσʔλΛ࣋ͬͯ͘Δ (clone) …
1ճ͚ͩ • ࠷৽൛ΛऔΓࠐΉ (pull) • ฤू͢Δ • มߋ༰Λίϛοτ(ηʔϒ)͢Δ (add/commit) • ίϛοτ༰ΛϦϞʔτ(GitHub্ͷιʔεorigin)ʹө͢Δ (push) • ΈΜͳͷมߋΛऔΓࠐΉ (Pull RequestΛͩ͢) -> pullʹΔ
Demo