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

Git: an introduction

3765534fc2f04754512bfb85b2bc6421?s=47 Emily Hyland
February 28, 2013

Git: an introduction

3765534fc2f04754512bfb85b2bc6421?s=128

Emily Hyland

February 28, 2013
Tweet

More Decks by Emily Hyland

Other Decks in Programming

Transcript

  1. Git an introduction

  2. Rails Girls ATL

  3. hello@duien.com Emily Price   ✉ Text Text

  4. What is git?

  5. Git is a distributed version control system

  6. a version control system OK, so what is

  7. a version control system

  8. version snapshot of managed files a version control system

  9. version snapshot of managed files control save and retrieve versions

    a version control system
  10. version snapshot of managed files control save and retrieve versions

    system set of integrated tools a version control system
  11. version snapshot of managed files control save and retrieve versions

    system set of integrated tools a version control system
  12. Git is a version control system

  13. Git is a set of integrated tools to save and

    retrieve snapshots of managed files
  14. What does it mean that git is distributed?

  15. Let’s talk history

  16. In the beginning... there was local version control

  17. And then for teams... there was central version control

  18. Which evolved into... distributed version control

  19. What does it mean that git is distributed?

  20. What does it mean that git is distributed?

  21. What does it mean that git is distributed? No central

    server necessary
  22. What does it mean that git is distributed? No central

    server necessary Every copy contains full history
  23. What does it mean that git is distributed? No central

    server necessary Every copy contains full history Most operations don’t require network
  24. Why use version control?

  25. Why use version control?

  26. Why use version control? Allow rewinding changes

  27. Why use version control? Allow rewinding changes Easier to collaborate

  28. Why use version control? Allow rewinding changes Easier to collaborate

    See when something changed
  29. Terminology

  30. Git has a lot of terminology

  31. repository working directory commit index the full set of files

    and history lives in .git directory the visible files of your project everything outside of .git a snapshot of your project staging area for next commit
  32. remote repository local repository working directory index pull fetch push

    commit add checkout clone
  33. remote repository local repository working directory index pull fetch push

    commit add checkout clone
  34. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  35. remote repository working directory index fetch push commit add checkout

    clone local repository pull
  36. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  37. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  38. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  39. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  40. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  41. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  42. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  43. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  44. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  45. remote repository local repository working directory index fetch push commit

    add checkout clone pull
  46. The anatomy of a commit

  47. Every commit is identified by a SHA1 hash

  48. A hash function maps data of variable length to data

    of fixed length, predictably
  49. Digest::SHA1.hexdigest('foo') 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 SHA1

  50. Git hashes the contents and attributes of a commit

  51. Actions contents attributes files and directories changed, added or deleted

    SHA of parent commit message
  52. c14f2de blob a20b616 blob bc4d0fb blob commit tree parent author

    committer message 000742a 38a0164 1f62407 duien duien ... tree tree blob 38a0164 7095bff bc4d0fb tree blob blob 7095bff c14f2de a20b616
  53. Branching and merging

  54. time

  55. time master HEAD

  56. time master HEAD

  57. time master HEAD

  58. time master HEAD

  59. time comments HEAD master

  60. time comments HEAD master

  61. time comments master HEAD

  62. time master HEAD comments

  63. time master comments HEAD

  64. time master comments HEAD

  65. time master comments HEAD

  66. time comments master HEAD

  67. time master comments HEAD

  68. time master comments HEAD

  69. time master comments HEAD

  70. time master comments HEAD

  71. time master comments HEAD

  72. time master comments HEAD

  73. time master comments HEAD

  74. Putting it into practice

  75. GitHub has good install guides at help.github.com

  76. Make a git repo for your Rails Girls projects

  77. DEMO

  78. git-scm.com try.github.com help.github.com ndpsoftware.com/git-cheatsheet.html More Resources