Git workflows presentation


Published on

This is a presentation give to the Vancouver Drupal users group about moving to GIT as a version control system for a small development team. The presentation details the workflow we settled on, and the git flow method for branch management. You can see a video of the presentation here -

Published in: Technology, Business
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Git workflows presentation

  1. 1. Git workflows for Drupal  projects Mack Hardy, Raphael Huefner, Smith Milner, Shawn Price @AffinityBridge
  2. 2. What is a workflow? "... a  sequence of connected steps " -Wikipedia The workflow we are looking for is an efficient method to allow multiple developers to integrate working code into a project. 
  3. 3. What is Git, and why should you use it <ul><ul><li>Distributed version control system </li></ul></ul><ul><ul><li>Fast </li></ul></ul><ul><ul><li>Easy and cheap branching </li></ul></ul><ul><ul><li> uses GIT </li></ul></ul>
  4. 4. SVN... in the beginning <ul><li>Our SVN workflow: </li></ul><ul><ul><li>branching is hard(er) </li></ul></ul><ul><ul><li>all work committed to and deployed from /trunk and release tags </li></ul></ul><ul><ul><li>could not commit locally, hard to work offline </li></ul></ul><ul><ul><li>hidden .svn folders made module updates difficult </li></ul></ul>
  5. 5. The move to Git <ul><ul><li>All the cool kids using it </li></ul></ul><ul><ul><li>Seemed to solve some of our SVN pain points </li></ul></ul><ul><ul><li>Wasn't as easy as we'd hoped </li></ul></ul><ul><ul><li>Expect productivity to go down before it goes up </li></ul></ul>
  6. 6. Submodules Everywhere $ git submodule add sites/all/modules/contrib/views Don't forget to push all commits to your submodules!
  7. 7. Where We Landed <ul><ul><li>Everything in one Git repo (i.e. no Git submodules) </li></ul></ul><ul><ul><li>2 long-living branches, &quot;master&quot; and &quot;develop&quot; </li></ul></ul><ul><ul><li>&quot;master&quot; is production ready all the time </li></ul></ul><ul><ul><li>Releases managed with tags </li></ul></ul><ul><ul><li>Separate &quot;feature&quot; or &quot;topic&quot; branches </li></ul></ul>
  8. 8. from
  9. 9. Network Graph from GitHub
  10. 10. The &quot;gitflow&quot; Git extension <ul><ul><li>Based on the previous graph </li></ul></ul><ul><ul><li>Project page </li></ul></ul><ul><ul><li>&quot;water wings&quot; or &quot;training wheels&quot; to stay on track </li></ul></ul><ul><ul><li>Command shortcuts for repetitive tasks </li></ul></ul><ul><ul><li>Branch naming convention &quot;<prefix>/<name>&quot;  </li></ul></ul>
  11. 11. gitflow: prepare repository $ git flow init rough equivalent: $ git init # if necessary $ # do some configuration (save prefix choices) $ # if there's no &quot;develop&quot; branch yet, create one: $ git checkout -b develop master This brings you away from the master branch. You should never commit to it directly anymore.
  12. 12. gitflow: start feature branch $ git flow feature start <featurename> rough equivalent: $ git checkout -b feature/<featurename> develop
  13. 13. gitflow: finish feature branch $ git flow feature finish <featurename> rough equivalent: $ git checkout develop $ git merge --no-ff feature/<featurename> $ git branch -d feature/<featurename>
  14. 14. gitflow: start release branch $ git flow release start <release#> rough equivalent: $ git checkout -b release/<release#> develop
  15. 15. gitflow: finish release branch $ git flow release finish <release#> rough equivalent: $ git checkout master $ git merge --no-ff release/<release#> $ git tag -a <release#> $ git checkout develop $ git merge --no-ff release/<release#> $ git branch -d release/<release#>
  16. 16. gitflow: start hotfix branch $ git flow hotfix start <hotfix#> rough equivalent: $ git checkout -b hotfix/<hotfix#> master
  17. 17. gitflow: finish hotfix branch $ git flow hotfix finish <hotfix#> rough equivalent: $ git checkout master $ git merge --no-ff hotfix/<hotfix#> $ git tag -a <hotfix#> $ git checkout develop $ git merge --no-ff hotfix/<hotfix#> $ git branch -d hotfix/<hotfix#>
  18. 18. Git Deployment Consolidating the work of multiple developers and preparing it for release. Always have that production ready branch.
  19. 20. GIT and the Drupal Community <ul><ul><li> is now using GIT for version control. </li></ul></ul><ul><ul><li>Choosing Git for your own code means less tools to learn when also contributing to Drupal projects. </li></ul></ul><ul><ul><li>Git makes it easy to create and apply patches using  &quot;git diff&quot; and &quot;git apply&quot;. </li></ul></ul><ul><li>       </li></ul>
  20. 21. Wrapping Up <ul><ul><li>This is what works for us. You may find a process that fits you better. </li></ul></ul><ul><ul><li>Big win for us is ability to create new branches on a whim. </li></ul></ul><ul><ul><li>Knowing that master is always production ready helps us sleep at night. </li></ul></ul>
  21. 22. Resources Git Flow NVIE Branching Model SVN to GIT Crash Course