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

Intro to Git and GitHub

Intro to Git and GitHub

Are you curious what Git and GitHub are? Let Matthew McCullough of GitHub show you in just a few short minutes and a series of instructive graphics.

Bededa744012c87721d68f69342f81b0?s=128

Matthew McCullough

March 05, 2012
Tweet

Transcript

  1. Introduction to Git & GitHub by Matthew McCullough

  2. Matthew McCullough @matthewmccull

  3. None
  4. None
  5. None
  6. None
  7. None
  8. a brief history of Git

  9. None
  10. “Cool kids” version control system

  11. Open Source

  12. bash scripts ☛ C code

  13. None
  14. I'm an egotistical bastard, and I name all my projects

    after myself. First Linux, now git. -Linus Torvalds “ ”
  15. GitHub a RIA for Git

  16. Social coding, within the Enterprise

  17. None
  18. Version control as a virtual appliance

  19. None
  20. Desktop tools as HTML5 components

  21. None
  22. In-browser syntax highlighted code editing

  23. None
  24. Conversations on proposed code changes

  25. None
  26. None
  27. setting up a Git Repo

  28. No daemon

  29. No special repo area

  30. None
  31. > cd myproj > git init Initialized empty Git repository

    in /stuff/myproj/.git/
  32. Deltas vs. Copies

  33. Typical SCMs use deltas

  34. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B
  35. CVS, Subversion, darcs & Mercurial

  36. None
  37. Checkin Checkin Checkin Checkin Checkin Checkin Checkin Checkin Checkin Checkin

    Checkin Delta storage gets slower as the history of a file gets longer
  38. Git uses Directed Acyclic Graph storage

  39. cp -r srcfolder srcfolder.prev

  40. Copy of the entire tree per checkin

  41. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  42. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  43. hardlinks to existing identical blobs

  44. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  45. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  46. zlib deflates every blob at commit

  47. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  48. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  49. zlib deflates entire repo

  50. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  51. v1 v2 v3 v4 File A File B File C

    File A File B File B File C v5 File A File B File B File A File A File C File C File C
  52. 2100 MB became 205 MB Act I

  53. Add and Commit

  54. None
  55. Working Staging Repo checkout add commit

  56. None
  57. > git add <FILENAME>

  58. None
  59. > git status # On branch master # Initial commit

    # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # new file: myfile.txt
  60. None
  61. > git commit -m”<MESSAGE>” [master (root-commit) 498cc44] My first commit

    1 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 myfile.txt
  62. Local Branches Remote Branches Upstream Branches Working Copy commit

  63. Branch and Checkout

  64. None
  65. > git branch <BRANCHNAME>

  66. Local Branches Remote Branches Upstream Branches Working Copy

  67. Local Branches Remote Branches Upstream Branches Working Copy

  68. None
  69. > git checkout <BRANCHNAME> Switched to branch 'mybranch'

  70. Local Branches Remote Branches Upstream Branches Working Copy

  71. Local Branches Remote Branches Upstream Branches Working Copy

  72. Commit Ref Syntax

  73. None
  74. 9AB223D28B1AA46EF1780B22F304982E39872C34 <html> <body> <p>This is a test</p> <img src="http://ai.com/ icon.gif">

    </body> </html>
  75. 9AB223D28B1AA46EF1780B22F304982E39872C34 <html> <body> <p>This is a test</p> <img src="http://ai.com/ icon.gif">

    </body> </html>
  76. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  77. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  78. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  79. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  80. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  81. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  82. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  83. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  84. tree tree: 7e8b1 web blob: 9ab16 index.html a10b3 tree blob:

    8d162 logo.jpg blob: 51d22 draw.js 7e8b1 commit tree: a10b3 parent: nil author: Fird committer: Matthew message: Major refactoring of the web content. c67db blob <html> <body></body> </html> 9ab16 blob //Some more javascript var renderSize 51d22 blob 7D 8D B3 7F BD 12 9F E9 7B 78 9D 3F 5C A6 72 CB 8d162
  85. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  86. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  87. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  88. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  89. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  90. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  91. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  92. v1 v2 v3 commit tree: 9a87b parent: nil author: Fird

    committer: Matthew message: Major refactoring of the Javascript rendering engine. c67db commit tree: b22c1 parent: c67db author: Tim committer: Fird message: Minor update to HTML 9bd21 commit tree: b22c1 parent: 9bd21 author: Johnny committer: Joe message: New language transations 1c2d7
  93. Distributed Connectivity

  94. developer A

  95. developer A developer B

  96. developer A developer B

  97. developer A developer B

  98. blessed repo developer A developer B

  99. Workflows and collaboration

  100. Central Repo C e n t r a l i

    z e d
  101. Central Repo C e n t r a l i

    z e d
  102. Blessed Repo D i c t a t o r

    s h i p
  103. Blessed Repo D i c t a t o r

    s h i p
  104. Blessed Repo D i c t a t o r

    s h i p
  105. Blessed Repo D i c t a t o r

    s h i p
  106. Blessed Repo D i c t a t o r

    s h i p
  107. Certified Repo Development Repo I n t e g r

    a t i o n M a n a g e d
  108. Certified Repo Development Repo I n t e g r

    a t i o n M a n a g e d
  109. Certified Repo Development Repo I n t e g r

    a t i o n M a n a g e d
  110. Certified Repo Development Repo I n t e g r

    a t i o n M a n a g e d
  111. Mirror Development Repo M i r r o r e

    d Mirror Certified Repo
  112. Mirror Development Repo M i r r o r e

    d Mirror Certified Repo
  113. C u s t o m + P u b

    l i c C o n t r i b ☚ Private Public ☛ GitHub
  114. C u s t o m + P u b

    l i c C o n t r i b ☚ Private Public ☛ GitHub
  115. C u s t o m + P u b

    l i c C o n t r i b Customized ☚ Private Public ☛ GitHub
  116. C u s t o m + P u b

    l i c C o n t r i b Customized ☚ Private Public ☛ GitHub
  117. Git’s notable users

  118. None
  119. None
  120. None
  121. None
  122. None
  123. None
  124. Introduction to Git & GitHub by Matthew McCullough