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

Version Control - Tips, tricks & good citizenship June 2016

Version Control - Tips, tricks & good citizenship June 2016

Given at php south coast June 2016. High level view of version control and how it fits into a wider picture of processes. Includes discussion on how difficulties with version control can be a reflection of issues in other areas of the business. Due to the lightening talk format and community choices, most focus centred on branching techniques and conflict resolution.

Tess Barnes

June 11, 2016
Tweet

More Decks by Tess Barnes

Other Decks in Programming

Transcript

  1. HOPEFULLY… WHAT WE WILL COVER • how good citizenship fits

    in • fundamentals • conflict resolution • branching • documentation • the right tool for the right reasons
  2. 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
  3. WHAT’S IT GOT TO DO WITH CODE? GOOD (CODE) CITIZENSHIP

    • version control is the hub of a bigger system
  4. 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
  5. 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
  6. 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
  7. 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
  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 • keeping our house clean • doing what we agreed • sharing what we know • inviting feedback
  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 • doing what we agreed • sharing what we know • inviting feedback • moving forward together
  10. HIGH LEVEL VIEW THE FUNDAMENTALS • version control is a

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

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

    keystone of good development practices • lots of tools available, some good, some awful • sharing code
  13. 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
  14. 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
  15. 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
  16. THE SEQUENCE THE FUNDAMENTALS 1. separate 2. change 3. merge

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

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

    4. snapshot 5. release • refresh (1…n) • test (1…n) • sanity check
  19. 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
  20. 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
  21. 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
  22. 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
  23. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

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

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - not just version control users
  25. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - not just version control users • linked to issue and story trackers - don’t duplicate data
  26. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - not just version control users • linked to issue and story trackers - don’t duplicate data • used for code review in merge requests
  27. THE ART OF A GOOD COMMIT MESSAGE (IMO) DOCUMENTATION •

    succinct, informative, meaningful, consistent, agreed • could be scraped for release notes - not just version control users • linked to issue and story trackers - don’t duplicate data • used for code review in merge requests • pattern enforced using commit hooks
  28. 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)
  29. 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)
  30. 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)
  31. NOT EVERYONE USES GIT! RIGHT TOOL FOR THE RIGHT JOB

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

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

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

    the first priority may not be to change version control tool • choose a version control system that suits your business
  35. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool • choose a version control system that suits your business • most importantly…
  36. RESPECT YOUR COMMUNITY RIGHT TOOL FOR THE RIGHT JOB •

    the first priority may not be to change version control tool • choose a version control system that suits your business • most importantly… know WHY