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. VERSION CONTROL
    TIPS, TRICKS & GOOD CITIZENSHIP

    View Slide

  2. @CRATAEGUSTESS HTTPS://JOIND.IN/TALK/FA438
    TESS BARNES
    • multi language developer
    • currently working for Fasthosts
    • tech lead
    • agile advocate

    View Slide

  3. HOPEFULLY…
    WHAT WE WILL COVER
    • how good citizenship fits in
    • fundamentals
    • conflict resolution
    • branching
    • documentation
    • the right tool for the right reasons

    View Slide

  4. GOOD (CODE) CITIZENSHIP
    WHAT’S IT ALL ABOUT?

    View Slide

  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

    View Slide

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

    View Slide

  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

    View Slide

  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

    View Slide

  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

    View Slide

  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
    • sharing what we know

    View Slide

  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
    • inviting feedback

    View Slide

  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
    • moving forward together

    View Slide

  13. THE FUNDAMENTALS
    CREATING SOMETHING GREAT TO BUILD ON

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  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 • integrating code

    View Slide

  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
    • safeguarding code snapshots
    • integrating code

    View Slide

  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
    • allowing easy rollback

    View Slide

  20. THE SEQUENCE
    THE FUNDAMENTALS
    1. separate

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  30. HANDLING CONFLICTS
    DOING WHAT WE AGREED

    View Slide

  31. HANDLING CONFLICTS
    • some version control tools handle this better than others

    View Slide

  32. View Slide

  33. HANDLING CONFLICTS
    • some version control tools handle this better than others
    • some tools hide issues

    View Slide

  34. View Slide

  35. View Slide

  36. 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

    View Slide

  37. 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

    View Slide

  38. BRANCHING STRATEGIES
    KEEPING OUR HOUSE CLEAN

    View Slide

  39. 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

    View Slide

  40. BRANCHING STRATEGIES
    IS BRANCHING CHEAP?

    View Slide

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

    View Slide

  42. 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

    View Slide

  43. BRANCHING STRATEGIES
    CONTINUOUS INTEGRATION
    master
    production
    tag live hot fix
    MR
    MR / push
    fetch/
    pull
    clone1 clone 2
    MR

    View Slide

  44. BRANCHING STRATEGIES
    MULTIPLE DEPLOYMENT ENVIRONMENTS
    Production
    Staging
    Master
    clone1
    clone2
    clone3
    tag live hot fix
    MR
    MR
    MR
    MR
    MR / push
    fetch /
    pull

    View Slide

  45. DOCUMENTATION
    SHARING WHAT WE KNOW & INVITING FEEDBACK

    View Slide

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

    View Slide

  47. 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

    View Slide

  48. 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

    View Slide

  49. 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

    View Slide

  50. 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

    View Slide

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

    View Slide

  52. 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)

    View Slide

  53. 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)

    View Slide

  54. 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)

    View Slide

  55. RIGHT TOOL FOR THE RIGHT JOB
    MOVING FORWARD TOGETHER

    View Slide

  56. RIGHT TOOL FOR THE RIGHT JOB

    View Slide

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

    View Slide

  58. 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?

    View Slide

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

    View Slide

  60. 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

    View Slide

  61. 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…

    View Slide

  62. 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

    View Slide

  63. View Slide

  64. View Slide

  65. THANK YOU FOR
    LISTENING
    TESS BARNES @CRATAEGUSTESS
    JOIND.IN: HTTPS://JOIND.IN/TALK/FA438

    View Slide