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

Get Good with Git

Luke Stringer
December 06, 2018

Get Good with Git

Using Version Control to Deliver Quality Software.

A look into how 3Squared use version control to enable collaboration, ensure code quality, fix bugs, and ultimately release software.

Delivered at The University of Sheffield as part of the Institute of Coding talks

Luke Stringer

December 06, 2018
Tweet

More Decks by Luke Stringer

Other Decks in Technology

Transcript

  1. Get Good with Git
    Using Version Control to Deliver Quality Software

    View full-size slide

  2. 2008 - 2012
    MEng Software
    Engineering

    View full-size slide

  3. I’m the
    Head of
    Development
    at 3Squared

    View full-size slide

  4. Version Control is
    Key to our Success !

    View full-size slide

  5. Who has used a
    Version Control System? "

    View full-size slide

  6. Version control is a system that
    records changes to a file or set
    of files over time so that you
    can recall specific versions
    later.

    View full-size slide

  7. Git is a Distributed
    Version Control
    System (DVCS) #

    View full-size slide

  8. Designed for
    Linux
    Development

    View full-size slide

  9. I'm an egotistical bastard, and
    I name all my projects after
    myself. First 'Linux', now 'git'.
    - Linus Torvalds

    View full-size slide

  10. It has
    Lots of Benefits $
    It allows us to…

    View full-size slide

  11. Backup our Work %

    View full-size slide

  12. Work as a Team &

    View full-size slide

  13. Work Offline ✈

    View full-size slide

  14. Do things Fast ⚡

    View full-size slide

  15. Identify, Diagnose &
    Fix Bugs ()

    View full-size slide

  16. Bug!
    git bisect

    View full-size slide

  17. Step 1
    Good
    Bad

    View full-size slide

  18. Good
    Bad
    Step 1
    Bad

    View full-size slide

  19. Step 2
    Good
    Bad

    View full-size slide

  20. Step 2
    Good
    Good
    Bad

    View full-size slide

  21. Good
    Bad
    Step 3

    View full-size slide

  22. Good
    Bad
    Step 3
    Good

    View full-size slide

  23. Good
    Bad
    First Bad
    Commit

    View full-size slide

  24. Be Flexible *

    View full-size slide

  25. With Great Power
    comes Great
    Responsibility

    View full-size slide

  26. Effective Team Work
    requires Rules +

    View full-size slide

  27. Write descriptive
    Commit Messages ✏
    Explain why you did something

    View full-size slide

  28. Commit Early &
    Commit Often -

    View full-size slide

  29. Follow a
    Branching Policy .

    View full-size slide

  30. We use Git-Flow

    View full-size slide

  31. The Main Branches
    • master represents code in a
    production ready state.
    • Each commit on master is
    tagged with a release
    number
    • develop represents code
    for the next release.

    View full-size slide

  32. Feature Branches
    • Developing features for the
    next release.
    • Branch from: develop
    • Merge into: develop
    • Named: feature/_, e.g.
    feature/login
    • Multiple features can be
    worked on in parallel by
    the team.

    View full-size slide

  33. Release Branches
    • Prepare for production when
    all features are complete.
    • Branch from: develop
    • Merge into: develop &
    master
    • Named: release/_, e.g.
    release/1.0.1
    • Only one release at a time.
    • Merge with master is tagged
    with the release number.

    View full-size slide

  34. Hotfix Branches
    • Used to quickly react to
    critical bugs in production.
    • Branch from: master
    • Merge into: develop &
    master
    • Named: hotfix/_, e.g.
    release/1.2.1
    • Other team member can
    carry on with feature work.

    View full-size slide

  35. http://nvie.com/posts/a-successful-git-branching-model/

    View full-size slide

  36. Git & Git-Flow
    Caveats ⚠

    View full-size slide

  37. A Release contains all
    Completed Features 0

    View full-size slide

  38. Merge Conflicts
    will occur 1
    so approach them in the right way…

    View full-size slide

  39. Communicate with
    your Team 2
    to minimise changes to the same file across
    branches

    View full-size slide

  40. Prevent Feature
    Divergence 3
    by periodically merging develop into
    feature branches

    View full-size slide

  41. Potentially nasty merge conflicts

    View full-size slide

  42. Smaller merge conflicts
    Smaller merge conflicts

    View full-size slide

  43. Collaboration requires
    Connectivity 4

    View full-size slide

  44. Use a Centralised
    “Truth” Repository 5

    View full-size slide

  45. Git Repositories
    Hosted Internally 6

    View full-size slide

  46. Merge Requests used
    for Code Review 7

    View full-size slide

  47. develop
    feature
    branches

    View full-size slide

  48. develop
    feature
    branches
    8

    View full-size slide

  49. develop
    feature
    branches
    ? Merge Request = code review
    8

    View full-size slide

  50. develop
    feature
    branches
    8

    View full-size slide

  51. develop
    feature
    branches
    ? Merge Request = code review
    8

    View full-size slide

  52. develop
    feature
    branches
    Merge Request accepted
    8

    View full-size slide

  53. Branches form basis
    for Deployments 9

    View full-size slide

  54. 9!QA
    9!QA
    9!QA
    9!QA

    View full-size slide

  55. 9!Stag
    9!Stag
    9!Stag
    9!Prod

    View full-size slide

  56. Summary
    • Git is enables fast, flexible collaborative software
    development
    • Bug-fixing is made easier with git bisect
    • With Great Power comes Great Responsibility
    • Following a branching policy like Git-Flow standardises
    development & deployment processes
    !"#$%&✈⚡ ()* +✏ -.⚠ 0 1 2 3 4 6 7 9

    View full-size slide

  57. Thank You :
    [email protected]
    Twitter / GitHub: lukestringer90

    View full-size slide