Bang a Gong, GIT It On, or Running Drupal With a GIT Repository (11/04/20 - B Gruneberg))


Published on

Enjoy a technical overview of working with a GIT repository, its advantages and benefits, and how to set it up.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Bang a Gong, GIT It On, or Running Drupal With a GIT Repository (11/04/20 - B Gruneberg))

  1. 1. Welcome to: GIT … and Drupal sitting in a Tree ( yes – the data-structure ) A DrupalCape Presentation by: Perceptum Thought Squad 20/Apr/2011 Presenter: Bryan Gruneberg
  2. 2. Our Journey <ul><li>“ One Good Thief is Worth Ten Good Scholars” – Randy Pausch
  3. 3. About GIT </li><ul><li>The Linus Legacy </li></ul><li>Understanding GIT </li><ul><li>Repositories
  4. 4. Branching
  5. 5. Merging
  6. 6. Collaborating </li></ul><li>Drupal & GIT </li><ul><li>
  7. 7. What Perceptum Does
  8. 8. Why CI makes sense </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  9. 9. One Good Thief is Worth Ten Good Scholars the pretty pics end here... ;) Checked out “Randy Pausch on Time Management” YouTube: <ul><li> - Understanding Git Conceptually
  10. 10. - Using Git on </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  11. 11. About GIT <ul><li>Git development began after many Linux kernel developers chose to give up access to the proprietary BitKeeper system
  12. 12. Take CVS as an example of what not to do; if in doubt, make the exact opposite decision
  13. 13. Support Distributed Version Control
  14. 14. Strong safeguards against corruption
  16. 16. Design is a synthesis of Linus' experiences in maintaining a large distributed development project </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  17. 17. What's in a name?? <ul><li>Quoting Linus: &quot;I'm an egotistical ***, and I name all my projects after myself. First 'Linux', now 'git'&quot;.
  18. 18. Alternatively &quot;git&quot; can mean anything, depending on your mood: </li><ul><li>Random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of &quot;get&quot; may or may not be relevant.
  19. 19. Stupid. Contemptible and despicable. Simple. Take your pick from the dictionary of slang.
  20. 20. &quot;Global information tracker&quot;: you're in a good mood, and it actually works for you. Angels sing and light suddenly fills the room.
  21. 21. &quot;Goddamn idiotic truckload of sh*t&quot;: when it breaks </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  22. 22. GIT Characteristics <ul><li>Strong support for non-linear development
  23. 23. Distributed development
  24. 24. Compatibility with existing systems/protocols (HTTP, FTP, RSYNC, SSH)
  25. 25. Efficient large projects (does not get slower as the project history grows)
  26. 26. Cryptographic authentication of history </li><ul><li>Once published, not possible to change old versions secretly </li></ul><li>Toolkit-based design (C & Sh => C)
  27. 27. Pluggable merge strategies (attempted merge 1,2...,n => error)
  28. 28. Periodic explicit object packing </li><ul><li>Each newly created object as a file
  29. 29. Packing similar files together
  30. 30. Periodic packing done by GIT... or “git gc –prune” to force </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  31. 31. Understanding GIT <ul><li>Many resources on Git walk you through which commands to run when, and expect that you should do fine if you just mimic those commands
  32. 32. The other half does go through all the concepts, but they explain Git in a manner that assumes you already understand how Git works
  33. 33. Merely memorizing which commands you should run at what times will work in the short run (SO DO IT!!!)
  34. 34. But it’s only a matter of time before you get stuck or break something... so here is an overview of what happens inside the big-black-git-box... </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  35. 35. Repositories Important things to know... <ul><li>GIT Repositories contain a set of commit objects </li><ul><li>A set of files, reflecting the state of a project at a given point in time.
  36. 36. References to parent commit objects.
  37. 37. An SHA1 name, a 40-character string that uniquely identifies the commit object </li></ul><li>GIT Repositories contain a set of references to commit objects </li><ul><li>called heads </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  38. 38. Graphically... 20/Apr/2011 Presenter: Bryan Gruneberg
  39. 39. Wordy... <ul><li>A blob object is the content of a file. </li><ul><li>Blob objects have no filename, timestamps, or other metadata. </li></ul><li>A tree object is the equivalent of a directory. </li><ul><li>Contains a list of filenames and the name of a blob or tree object that is that file, symbolic link, or directory's contents.
  40. 40. This object describes a snapshot of the source tree. </li></ul><li>A commit object links tree objects together into a history. </li><ul><li>Contains </li><ul><li>the name of a tree object (of the top-level source directory),
  41. 41. a timestamp,
  42. 42. a log message, and
  43. 43. the names of zero or more parent commit objects </li></ul></ul><li>A tag object is a container that contains reference to another object and can hold additional meta-data related to another object. </li><ul><li>Generally used to store a digital signature of a commit object corresponding to a particular release of the data being tracked by Git. </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  44. 44. More on commit objects (yes – that important...) <ul><li>Parent commit objects are those commits that were edited to produce the subsequent state of the project.
  45. 45. A project always has one commit object with no parents. This is the first commit made to the project repository (initial commit)
  46. 46. You can visualize a repository as a directed acyclic graph of commit objects </li><ul><li>pointers to parent commits always pointing backwards in time
  47. 47. Starting from any commit, you can walk along the tree by parent commits to see the history of changes that led to that commit. </li></ul><li>So... NB: GIT version control is all about manipulating this graph of commits </li><ul><li>Whenever you want to perform an operation to query or manipulate the repository, you should be thinking, “how do I want to query or manipulate the graph of commits?” </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  48. 48. Don't lose your head... <ul><li>A “head” is a reference to a commit object
  49. 49. Each head has a name </li><ul><li>By default, there is a head in every repository called master
  50. 50. A repository can contain any number of heads
  51. 51. At any given time, one head is selected as the “current head” </li><ul><li>aliased to HEAD, all-caps. </li></ul></ul><li>**NB** </li><ul><li>“ head” (lowercase) refers to any one of the named heads in the repository
  52. 52. “ HEAD” (uppercase) refers exclusively to the currently active head
  53. 53. This is used seen in Git documentation, and isn't always explicitly explained </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  54. 54. Looks like this... 20/Apr/2011 Presenter: Bryan Gruneberg
  55. 55. Branching Scenario... <ul><li>You build a Drupal theme
  56. 56. You commit the theme code, and let customers review
  57. 57. While they review, you carry on with new functionality
  58. 58. They revert and ask that all <span class=header> tags to be changed to <h4> tags
  59. 59. You want to fix the code for them, but you don't want them to have access to the half-baked new feature code </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  60. 60. Branching... 20/Apr/2011 Presenter: Bryan Gruneberg
  61. 61. Branching... result 20/Apr/2011 Presenter: Bryan Gruneberg
  62. 62. Merging <ul><li>Once you are done working on a branch, you often want to bring those changes into a main stream of development
  63. 63. Git merge </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  64. 64. Collaborating GIT allows you to share repository data from other developers <ul><li>Git clone <repository>
  65. 65. Git pull
  66. 66. NB </li><ul><li>YOU WILL HAVE THE ENTIRE HISTORY </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  67. 67. Collaborating... GIT allows you to share repository data with other developers <ul><li>git push
  68. 68. Essentially this is... </li><ul><li>Pushing your changes to the remote
  69. 69. Setting the remote-head to the remote head the pushing-repository referred to </li></ul><li>If no arguments are given to git push, it will push all the branches in the repository that are set up for tracking. </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  70. 70. Drupal & GIT <ul><li>Drupal used to use CVS (eeugh)
  71. 71. Drupal now uses GIT (yay)
  72. 72. account integrated with git account
  73. 73. projects are all git repositories
  74. 74. Drupal core is in GIT </li></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  75. 75. & SSH Keys <ul><li> now uses SSH Keys </li><ul><li>Create keys (ssh-keygen / puttygen)
  76. 76. Only share .pub!!!
  77. 77. KEEP THE OTHER SECRET... SECRET! </li></ul><li>You can then... </li><ul><li>Create new Drupal projects (modules)
  78. 78. Contribute to modules where you have been given access </li></ul></ul>20/Apr/2011 Presenter: Bryan Gruneberg
  79. 79. What Perceptum does... 20/Apr/2011 Presenter: Bryan Gruneberg
  80. 80. Why CI Makes Sense 20/Apr/2011 Presenter: Bryan Gruneberg