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

Laradebut #03 從 git 入門到團隊合作開發

Ab628671841774343b1020f22f712069?s=47 mouson
August 18, 2016

Laradebut #03 從 git 入門到團隊合作開發

本簡報介紹版本管理 ( Version Control ) git 的基礎指令,一直到基本的團隊合作開發的展示,講解的部份以動畫的方式呈現,希望降低 git 指令入門的門檻。

發表於:Laradebut #3 於 urAd

內容所提到的 github 連結置於:
https://github.com/mouson/laradebut3-demo

錄影紀實:
https://www.youtube.com/watch?v=sEloF3SzGI8

Ab628671841774343b1020f22f712069?s=128

mouson

August 18, 2016
Tweet

Transcript

  1. ℂ 獈槹 ک㿁褧ݳ֢樄咳 Mouson 檔֚ᒓ<mouson@gmail.com> Duncan 讙෈盓<duncan.bbs@gmail.com> Laradubet #03 -

    2016.08.18 @ i
  2. https://goo.gl/ECb425

  3. 瞲犤च器

  4. git 玟ऒ獤觊 Local Local Repo/ Master Staging Area Workspace

  5. git init - 虻碘䓚ڡত Local Local Repo/ Master Staging Area

    Workspace git init
  6. git init - 虻碘䓚ڡত Local Local Repo/ Master Staging Area

    Workspace git init
  7. git status Local Local Repo/ Master Staging Area Workspace git

    status
  8. git status Local Local Repo/ Master Staging Area Workspace git

    status
  9. git add [folder/file] 碝ी Local Local Repo/ Master Staging Area

    Workspace git add
  10. git commit Local Local Repo/ Master Staging Area Workspace git

    add git commit
  11. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace
  12. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace Hunk A
  13. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add Hunk A
  14. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add git commit Hunk A
  15. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add git commit Hunk A HASH A
  16. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace Hunk A HASH A
  17. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace Hunk A HASH A Hunk B Hunk C Hunk D
  18. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add Hunk A HASH A Hunk D Hunk B Hunk C
  19. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add git commit Hunk A HASH A Hunk D Hunk B Hunk C
  20. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add git commit Hunk A HASH A Hunk D Hunk B Hunk C HASH B
  21. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace Hunk A HASH A Hunk D Hunk B Hunk C HASH B
  22. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add Hunk A HASH A Hunk B Hunk C HASH B Hunk D
  23. git add & commit 奲ݳದ Local Local Repo/ Master Staging

    Area Workspace git add git commit Hunk A HASH A Hunk B Hunk C HASH B Hunk D HASH C
  24. git HEAD Local Local Repo/ Master Staging Area Workspace Hunk

    A HASH A Hunk B Hunk C HASH B Hunk D HASH C
  25. git HEAD Local Local Repo/ Master Staging Area Workspace Hunk

    A HASH A Hunk B Hunk C HASH B Hunk D HASH C HEAD
  26. git HEAD Local Local Repo/ Master Staging Area Workspace Hunk

    A HASH A Hunk B Hunk C HASH B Hunk D HASH C HEAD HEAD^
  27. git HEAD Local Local Repo/ Master Staging Area Workspace Hunk

    A HASH A Hunk B Hunk C HASH B Hunk D HASH C HEAD HEAD^ HEAD^^
  28. git reset --mixed ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk D HASH C Hunk A HASH A Hunk B Hunk C HASH B
  29. git reset --mixed ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace —mixed HEAD^ Hunk D HASH C Hunk A HASH A Hunk B Hunk C HASH B
  30. git reset --mixed ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace —mixed HEAD^ Hunk D Hunk A HASH A Hunk B Hunk C HASH B
  31. git reset --soft ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk D HASH C Hunk A HASH A Hunk B Hunk C HASH B
  32. git reset --soft ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk D HASH C Hunk A HASH A Hunk B Hunk C HASH B —soft HEAD^
  33. git reset --soft ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk A HASH A Hunk B Hunk C HASH B —soft HEAD^ Hunk D
  34. git reset --hard ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk D HASH C Hunk A HASH A Hunk B Hunk C HASH B
  35. git reset --hard ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk D HASH C Hunk A HASH A Hunk B Hunk C HASH B git reset —hard HEAD^
  36. git reset --hard ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk D Hunk A HASH A Hunk B Hunk C HASH B git reset —hard HEAD^
  37. git reset --hard ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace Hunk A HASH A Hunk B Hunk C HASH B git reset —hard HEAD^
  38. git reset […] ᯿ᗝ Local Local Repo/ Master Staging Area

    Workspace —mixed HEAD^ git reset —hard HEAD^ —soft HEAD^
  39. git remote add origin git@git.. Local Remote Remote Repo/ Master

    Remote Repo/ Master Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B
  40. git push -u origin master Local Remote Remote Repo/ Master

    Remote Repo/ Master Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B
  41. git push -u origin master Local Remote Remote Repo/ Master

    Remote Repo/ Master Local Repo/ Master Staging Area Workspace git push HASH C HASH A HASH B HASH C HASH A HASH B
  42. git push -u origin master Local Remote Remote Repo/ Master

    Remote Repo/ Master Local Repo/ Master Staging Area Workspace git push HASH C HASH A HASH B HASH C HASH A HASH B
  43. git push -u origin master Local Remote Remote Repo/ Master

    Remote Repo/ Master Local Repo/ Master Staging Area Workspace git push HASH C HASH A HASH B HASH C HASH A HASH B HASH C HASH A HASH B
  44. git fetch Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B HASH C HASH A HASH B
  45. git fetch Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B HASH D HASH C HASH A HASH B HASH D
  46. git fetch Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B git fetch HASH D HASH C HASH A HASH B HASH D
  47. git fetch Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B git fetch HASH C HASH A HASH B HASH D HASH D
  48. GIT BRANCH

  49. git branch Local Remote Local Repo/ Master Staging Area Workspace

    HASH C HASH A HASH B Remote Repo/ Master Remote Repo/ Master HASH C HASH A HASH B HASH C HASH A HASH B HASH D HASH D
  50. git branch Local Remote Local Repo/ Master HASH C HASH

    A HASH B
  51. git branch Local Remote Local Repo/ Master HASH C HASH

    A HASH B
  52. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop
  53. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop HASH C HASH A HASH B
  54. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop HASH C HASH A HASH B
  55. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop HASH C HASH A HASH B
  56. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop HASH C HASH A HASH B A B C
  57. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop HASH C HASH A HASH B A B C Master (HEAD)
  58. git branch Local Remote Local Repo/ Master Local Repo/ Develop

    HASH C HASH A HASH B git branch develop HASH C HASH A HASH B A B C Master Develop (HEAD)
  59. Local git checkout -b [name] A B C Master (HEAD)

  60. Local git checkout -b [name] A B C Master Develop

    (HEAD)
  61. Local git checkout -b [name] A B C Master Develop

    (HEAD)
  62. Local git checkout -b [name] A B C Master Develop

    (HEAD)
  63. Local git checkout -b [name] A B C Master Develop

    (HEAD) D
  64. Local git checkout -b [name] A B C Master Develop

    (HEAD) D
  65. Local git merge develop A B C Develop Master (HEAD)

    D
  66. Local git merge develop A B C Develop Master (HEAD)

    D
  67. Local git merge develop --ff (fast-forward) A B C Develop

    Master (HEAD) D E
  68. Local git merge develop --ff (fast-forward) A B C Develop

    Master (HEAD) D E
  69. Local git merge develop --no-ff A B C Develop Master

    (HEAD) D E
  70. Local git merge develop --no-ff A B C Develop Master

    (HEAD) D E F
  71. Local git merge develop --no-ff A B C Develop Master

    (HEAD) D E F
  72. Local git merge develop A B C Develop Master (HEAD)

    D E F
  73. Local git merge develop A B C Develop Master (HEAD)

    D E G F
  74. Local git merge develop A B C Develop Master (HEAD)

    D E G F
  75. Local git merge develop A B C Develop Master (HEAD)

    D E G F ݝ胼蝱ᤈ no-ff
  76. Local git rebase develop A B C Develop Master (HEAD)

    D E F
  77. Local git rebase develop A B C Develop Master (HEAD)

    D E F base
  78. Local base git rebase develop A B C Develop Master

    (HEAD) D E F
  79. Local base git rebase develop A B C Develop Master

    (HEAD) D E F F'
  80. Local base git rebase develop A B C Develop Master

    (HEAD) D E F F' ᯿碝懯ᓒ癩吖
  81. Local base git rebase develop A B C Develop Master

    (HEAD) D E F F' ᯿碝懯ᓒ癩吖
  82. Local base git rebase develop A B C Develop Master

    (HEAD) D E F F' ᯿碝懯ᓒ癩吖
  83. git merge with remote

  84. git merge Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B git fetch HASH D HASH C HASH A HASH B HASH D HASH D HASH D
  85. git merge Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace HASH C HASH A HASH B HASH C HASH A HASH B git fetch HASH D HASH C HASH A HASH B HASH D HASH D git merge HASH D HASH D
  86. git pull Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace git fetch git merge
  87. git pull Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace git fetch git merge git pull
  88. git pull --rebase Local Remote Remote Repo/ Master Remote Repo/

    Master Local Repo/ Master Staging Area Workspace git fetch git rebase
  89. git pull --rebase Local Remote Remote Repo/ Master Remote Repo/

    Master Local Repo/ Master Staging Area Workspace git fetch git rebase git pull --rebase
  90. GIT 䋿率 Demo

  91. ̿碍ڜ懯ᓒ̀䌕礯Օ奧 • 揲࿄羷碍 (Fibonacci Sequence) • P(0)=0, P(1)=1, P(N)=P(N-1)+P(N-2) •

    ૬᮷苭羷碍 (Padovan Sequence) • P(0)=P(1)=P(2)= 1, P(N)=P(N-2)+P(N-3)
  92. ̿碍ڜ懯ᓒ̀䌕礯Օ奧

  93. git clone Local Remote Remote Repo/ Master Remote Repo/ Master

    Local Repo/ Master Staging Area Workspace git clone
  94. Domo

  95. Demo

  96. None
  97. None
  98. None
  99. 塅ֺጱ Github 蝫奾 https://github.com/mouson/laradebut3-demo

  100. Recap

  101. None
  102. 蝱褩 git rebase

  103. ԰㵕藲碉 git rebase -i (--interactive)

  104. 狒ኸܻত娄瑽 git rebase -p (--preserve-merges)

  105. Q & A

  106. https://goo.gl/Ifte4S