Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git/GitHub入門-GitHubでたのしいチーム開発

Yuta Totz
August 24, 2015

 Git/GitHub入門-GitHubでたのしいチーム開発

岡山大学テクノロジーラボ(OTL)のGitとGitHubについての入門ワークショップのときのスライドです。

Yuta Totz

August 24, 2015
Tweet

More Decks by Yuta Totz

Other Decks in Programming

Transcript

  1. git

  2. $ git add FILENAME $ git commit -m “message” $

    git push 1. εςʔδϯάɾΤϦΞʹ௥Ճ 2. ϩʔΧϧͰมߋΛηʔϒ 3. ϩʔΧϧͷηʔϒΛϦϞʔτʹ΋ηʔϒ
  3. $ git add FILENAME $ git commit -m “message” 1.

    εςʔδϯάɾΤϦΞʹ௥Ճ 2. ϩʔΧϧͰมߋΛηʔϒ
  4. $ git add FILENAME $ git commit -m “message” $

    git push 1. εςʔδϯάɾΤϦΞʹ௥Ճ 2. ϩʔΧϧͰมߋΛηʔϒ 3. ϩʔΧϧͷηʔϒΛϦϞʔτʹ΋ηʔϒ
  5. ൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖ τπΧͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge

    fetch push ൴ঁͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge fetch push ϦϞʔτϦϙδτϦ (GitHub͕ϗετ)
  6. ϦϞʔτϦϙδτϦ (GitHub͕ϗετ) ൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖ τπΧͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT

    commit merge fetch push ൴ঁͷϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT commit merge fetch push ͜Ε͕෼ࢄʂʂʂ
  7. νʔϜ։ൃϑϩʔ • ࣗ෼ͷΞΧ΢ϯτʹσʔλΛෳ੡ (fork) • ϩʔΧϧ(ࣗ෼ͷPCͷத)ʹσʔλΛ࣋ͬͯ͘Δ (clone) • ฤू͢Δ •

    มߋ಺༰Λίϛοτ(ηʔϒ)͢Δ (add/commit) • ίϛοτ಺༰ΛϦϞʔτ(GitHub্ͷιʔε)ʹ൓ө͢Δ (push) • Pull RequestΛͩ͢ (GitHubͷը໘͔Βʂ)
  8. 2. ࣗ෼ͷPCʹ࣋ͬͯ͘Δ (clone) ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத

    clone (JU)VC ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
  9. 3. ฤू͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத (JU)VC

    ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
  10. 3. ฤू͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத (JU)VC

    ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT ฤूͨͬͨ͠ʂʂʂʂ
  11. 4. ίϛοτ(ηʔϒ)͢Δ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT add /

    commit ࣗ෼ͷ1$ͷத (JU)VC ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT
  12. 5. ϦϞʔτʹ൓ө͢Δʢpushʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத (JU)VC

    ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT PR มߋ͔ͨ͠Βऔ ΓࠐΜͰΑʔʂʂ
  13. 5. ϦϞʔτʹ൓ө͢Δʢpushʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத (JU)VC

    ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ JOEFYIUNM TUZMFDTT PR มߋ͔ͨ͠Βऔ ΓࠐΜͰΑʔʂʂ 0,
  14. 0. ΈΜͳͷมߋΛऔΓࠐΉ $ git pull upstream master ΦϦδφϧͷํͷϦϞʔτʢGitHub্ʣ͕มߋ͞Ε ͍ͯͨΒ࠷৽൛Λࣗ෼ͷιʔεʹऔΓࠐΉ $

    git remote add upstream https:// github.com/okadai-techlab/okayama-u- techlab.com.git ͯ͘Β΅ͷΦϦδφϧͷํ΋ϦϞʔτઌͱͯ͠ొ࿥͢Δ * ొ࿥͸࠷ॳͷҰճ͚ͩͰ͍͍Αʂ ‘upstrem’໊ͬͯલ͡Όͳͯ͘΋͍͍Αʂ
  15. 5. มߋΛऔΓࠐΜͰ΋Β͏ʢpull requestʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத

    (JU)VC ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT ΦϦδφϧʢຊମʣ upstream JOEFYIUNM TUZMFDTT ୭͔͕มߋͨ͠ ʢ࠷৽൛ʣ ෳ੡ origin
  16. 5. มߋΛऔΓࠐΜͰ΋Β͏ʢpull requestʣ ϩʔΧϧϦϙδτϦ JOEFYIUNM TUZMFDTT ϦϞʔτϦϙδτϦ JOEFYIUNM TUZMFDTT ࣗ෼ͷ1$ͷத

    (JU)VC ࣗ෼ͷΞΧ΢ϯτ JOEFYIUNM TUZMFDTT JOEFYIUNM TUZMFDTT pull ΦϦδφϧʢຊମʣ upstream ෳ੡ origin
  17. ൴ঁͱڞಉ࡞ۀΛ͢Δͱ͖ τπΧͷϩʔΧϧϦϙδτϦ 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
  18. νʔϜ։ൃϑϩʔ • ࣗ෼ͷΞΧ΢ϯτʹσʔλΛෳ੡ (fork) … 1ճ໨͚ͩ • ϩʔΧϧ(ࣗ෼ͷPCͷத)ʹσʔλΛ࣋ͬͯ͘Δ (clone) …

    1ճ໨͚ͩ • ࠷৽൛ΛऔΓࠐΉ (pull) • ฤू͢Δ • มߋ಺༰Λίϛοτ(ηʔϒ)͢Δ (add/commit) • ίϛοτ಺༰ΛϦϞʔτ(GitHub্ͷιʔεorigin)ʹ൓ө͢Δ (push) • ΈΜͳͷมߋΛऔΓࠐΉ (Pull RequestΛͩ͢) -> pullʹ໭Δ