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

Tips, Tricks & Good Citizenship

Tips, Tricks & Good Citizenship

What has version control got to do with good citizenship? How does this relate to code? How is your company culture and release policy reflected in your version control choices?

Join me in discussing how branching techniques can affect code conflicts and see what can happen when clever tools get too big for their boots!

An updated version of my June 2016 talk, given in July 2016 at @WorcSource; includes a clearer animated progress version of git lab flow style branching strategies.

079fb5d4ef22e8fe922d1cbb4ef34a3a?s=128

Tess Barnes

July 05, 2016
Tweet

Transcript

  1. VERSION CONTROL TIPS, TRICKS & GOOD CITIZENSHIP

  2. @CRATAEGUSTESS TESS BARNES • multi language developer • currently working

    for Fasthosts • tech lead • agile advocate • mental wellness advocate
  3. HOPEFULLY… WHAT WE WILL COVER • how good citizenship fits

    in • fundamentals • conflict resolution • branching • documentation • the right tool for the right reasons
  4. GOOD (CODE) CITIZENSHIP WHAT’S IT ALL ABOUT?

  5. EDUCATIONAL DEFINITION GOOD CITIZENSHIP Good citizens should always try to

    make a team-minded decision during any situation. Knowing what is right and wrong and understanding the consequences of a decision are important aspects of being a good citizen. Obeying laws and having respect for not only individuals in the community, but for the community itself, are other traits of a good citizen. Being helpful or helping those in need is another aspect of being a good citizen. from http://www.ask.com/world-view/qualities-good-citizen-5a9b527e5fe4adbc
  6. HTTPS://OSMIHELP.ORG HTTPS:// WWW.INDIEGOGO.COM/ PROJECTS/OPEN-SOURCING- MENTAL-ILLNESS-2016/ @OSMIHELP

  7. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system
  8. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system • creating something great to build on
  9. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system • creating something great to build on • keeping our house clean
  10. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system • creating something great to build on • keeping our house clean • doing what we agreed
  11. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system • creating something great to build on • keeping our house clean • doing what we agreed • sharing what we know
  12. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system • creating something great to build on • keeping our house clean • doing what we agreed • sharing what we know • inviting feedback
  13. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system • creating something great to build on • keeping our house clean • doing what we agreed • sharing what we know • inviting feedback • moving forward together
  14. THE FUNDAMENTALS CREATING SOMETHING GREAT TO BUILD ON

  15. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices
  16. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices • lots of tools available, some good, some awful
  17. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices • lots of tools available, some good, some awful • sharing code
  18. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices • lots of tools available, some good, some awful • sharing code • integrating code
  19. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices • lots of tools available, some good, some awful • sharing code • safeguarding code snapshots • integrating code
  20. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices • lots of tools available, some good, some awful • sharing code • safeguarding code snapshots • integrating code • allowing easy rollback
  21. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

    keystone of good development practices • lots of tools available, some good, some awful • sharing code • safeguarding code snapshots • not just code • integrating code • allowing easy rollback
  22. THE SEQUENCE THE FUNDAMENTALS 1. separate

  23. THE SEQUENCE THE FUNDAMENTALS 1. separate • refresh (1…n)

  24. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change • refresh

    (1…n)
  25. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change • refresh

    (1…n)
  26. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change • refresh

    (1…n) • test (1…n)
  27. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change 3. merge

    • refresh (1…n) • test (1…n)
  28. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change 3. merge

    • refresh (1…n) • test (1…n)
  29. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change 3. merge

    4. snapshot • refresh (1…n) • test (1…n)
  30. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change 3. merge

    4. snapshot 5. release • refresh (1…n) • test (1…n)
  31. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change 3. merge

    4. snapshot 5. release • refresh (1…n) • test (1…n) • sanity check
  32. HANDLING CONFLICTS DOING WHAT WE AGREED

  33. HANDLING CONFLICTS • some version control tools handle this better

    than others
  34. None
  35. HANDLING CONFLICTS • some version control tools handle this better

    than others • some tools hide issues
  36. <?php namespace RecipeForum; class Cleaver { private $weightInGrams; private $lengthInInch;

    private $percentSharp = 100; private $percentSteel; public function __construct($weightInGrams, $lengthInInch, $percentSteel) { $this->weightInGrams = $weightInGrams; $this->lengthInInch = $lengthInInch; $this->percentSteel = $percentSteel; } public function Sharpen($sharpener) { $this->weightInGrams -= 0.01; $this->percentSharp = 100; } public function Cut($foodItem) { $this->percentSharp -=1; } } <?php namespace RecipeForum; class Cleaver { private $loyaltyScore; private $age; private $favouriteChef; private $dateJoined; public function __construct($age, $loyaltyScore, $dateJoined) { $this->age = $age; $this->loyaltyScore = $loyaltyScore; $this->dateJoined = $dateJoined; } public function setFavouriteChef($chefId) { $this->favouriteChef = $chefId; } }
  37. None
  38. HANDLING CONFLICTS • some version control tools handle this better

    than others • some tools hide issues • remember - the conflict is in the code, design or interpretation, not the tool
  39. HANDLING CONFLICTS • some version control tools handle this better

    than others • some tools hide issues • remember - the conflict is in the code, design or interpretation, not the tool • how you branch / merge affects when, not if your conflicts occur
  40. BRANCHING STRATEGIES KEEPING OUR HOUSE CLEAN

  41. BRANCHING STRATEGIES DISTRIBUTED OR SINGLE SERVER origin clone 1 clone

    2 clone pull fetch merge request server / repo check in check out update working copy 1 working copy 2 working copy 3
  42. BRANCHING STRATEGIES IS BRANCHING CHEAP?

  43. BRANCHING STRATEGIES DEVELOPER OVERLAP? HOW DO YOU FEEL ABOUT SHARING?

  44. BRANCHING STRATEGIES RELEASE FOCUS OR FEATURE FOCUS v1.1 v1.2 clone

    / push master merge merge branch 1.1 branch 1.2 v5.1 MR MR MR master F1 F2 F3
  45. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production fetch / pull clone1

  46. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production fetch / pull clone1

    MR / push
  47. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production fetch / pull clone1

    MR MR / push
  48. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production fetch / pull clone1

    tag MR MR / push
  49. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production fetch / pull clone1

    clone2 tag MR
  50. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production MR / push fetch

    / pull clone1 clone2 tag MR
  51. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production MR MR / push

    fetch / pull clone1 clone2 tag
  52. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag MR MR /

    push fetch / pull clone1 clone2
  53. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag MR fetch /

    pull clone1 clone2 clone3
  54. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag MR fetch /

    pull clone1 clone2 MR / push clone3
  55. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag live hot fix

    MR fetch / pull clone1 clone2 MR / push clone3
  56. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag live hot fix

    MR fetch / pull clone1 clone2 MR / push clone3
  57. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag live hot fix

    MR fetch / pull clone1 clone2 tag MR / push clone3
  58. BRANCHING STRATEGIES CONTINUOUS INTEGRATION master production tag live hot fix

    MR fetch / pull MR clone1 clone2 MR / push clone3 tag
  59. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 master
  60. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 master MR / push
  61. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 master MR MR / push
  62. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 master clone2 MR MR / push
  63. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master clone2 MR
  64. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master clone2 MR / push MR
  65. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master clone2 MR / push fetch / pull MR
  66. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR clone2 MR / push
  67. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR clone2 fetch / pull
  68. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR MR clone2 fetch / pull
  69. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR clone2 tag fetch / pull MR
  70. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR clone2 tag MR / push MR
  71. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR clone2 MR / push tag live hot fix MR
  72. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master MR clone2 tag MR / push live hot fix MR
  73. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    clone1 clone3 master tag MR clone2 MR / push live hot fix MR
  74. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production fetch / pull

    MR clone1 clone3 master tag MR clone2 MR / push live hot fix MR
  75. BRANCHING STRATEGIES MULTIPLE DEPLOYMENT ENVIRONMENTS staging production live hot fix

    fetch / pull MR clone1 clone3 master tag MR MR clone2 MR / push MR
  76. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR clone2 MR / push
  77. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR MR / push live hot fix clone2
  78. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix clone2
  79. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix CHERRYPICK MR clone2
  80. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix tag CHERRYPICK MR MR clone2
  81. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR MR clone2
  82. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR MR live hot fix clone2
  83. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix MR clone2
  84. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix CHERRYPICK MR MR clone2
  85. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix CHERRYPICK MR CHERRYPICK MR MR clone2
  86. BRANCHING STRATEGIES LIVE HOT FIXES USING CHERRYPICKING staging production fetch

    / pull clone1 master MR tag MR / push MR live hot fix tag CHERRYPICK MR CHERRYPICK MR MR clone2
  87. DOCUMENTATION SHARING WHAT WE KNOW & INVITING FEEDBACK

  88. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct
  89. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative
  90. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful
  91. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent
  92. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed
  93. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - respect your intended audience
  94. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - respect your intended audience • linked to issue and story trackers - don’t duplicate data
  95. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - respect your intended audience • linked to issue and story trackers - don’t duplicate data • used for code review in merge requests
  96. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - respect your intended audience • linked to issue and story trackers - don’t duplicate data • used for code review in merge requests • pattern enforced using commit hooks
  97. ADDITIONAL THOUGHTS DOCUMENTATION • expected practices for open source (e.g.

    git hub templates)
  98. ADDITIONAL THOUGHTS DOCUMENTATION • expected practices for open source (e.g.

    git hub templates) • .gitmessage encouraging why & how over ‘one liners‘
 https://robots.thoughtbot.com/better-commit-messages-with-a-gitmessage- template • what (title)
  99. ADDITIONAL THOUGHTS DOCUMENTATION • expected practices for open source (e.g.

    git hub templates) • .gitmessage encouraging why & how over ‘one liners‘
 https://robots.thoughtbot.com/better-commit-messages-with-a-gitmessage- template • what (title) • why (link to feature)
  100. ADDITIONAL THOUGHTS DOCUMENTATION • expected practices for open source (e.g.

    git hub templates) • .gitmessage encouraging why & how over ‘one liners‘
 https://robots.thoughtbot.com/better-commit-messages-with-a-gitmessage- template • what (title) • why (link to feature) • how (details - pitched for your audience)
  101. RIGHT TOOL FOR THE RIGHT JOB MOVING FORWARD TOGETHER

  102. RIGHT TOOL FOR THE RIGHT JOB •

  103. NOT EVERYONE USES GIT! RIGHT TOOL FOR THE RIGHT JOB

    • git is distributed, prolific, popular and practically required for open source
  104. NOT EVERYONE USES GIT! RIGHT TOOL FOR THE RIGHT JOB

    • git is distributed, prolific, popular and practically required for open source • but there are still other tools out there… ➡ older companies and legacy projects? Subversion? ➡ proprietary code? Mercurial? ➡ c# houses? TFS?
  105. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool
  106. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool • make sure you’re fixing the right problems
  107. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool • make sure you’re fixing the right problems • the more you know your tools, the more powerful they become
  108. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool • make sure you’re fixing the right problems • the more you know your tools, the more powerful they become • choose a version control system that suits your business
  109. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool • make sure you’re fixing the right problems • the more you know your tools, the more powerful they become • choose a version control system that suits your business • most importantly… know WHY
  110. None
  111. None
  112. THANK YOU FOR LISTENING TESS BARNES @CRATAEGUSTESS

  113. HTTPS://OSMIHELP.ORG HTTPS:// WWW.INDIEGOGO.COM/ PROJECTS/OPEN-SOURCING- MENTAL-ILLNESS-2016/ @OSMIHELP