$30 off During Our Annual Pro Sale. View Details »

Even (Git) flow

Even (Git) flow

For the "know your tools" series: let's study the pros and cons of the different GIT workflows and when to apply them, through the story of Eddie, a developer with a constantly evolving project.

Antonello D'Ippolito

November 28, 2018
Tweet

More Decks by Antonello D'Ippolito

Other Decks in Programming

Transcript

  1. Even (GIT) flow
    a.k.a the story of Eddie

    View Slide

  2. Hello!
    I’m Antonello D’Ippolito
    Twitter, GitHub: @antodippo
    DOING -> VONQ (NL)
    2

    View Slide

  3. Even (GIT) flow | @antodippo | November 2018
    Eddie and his project
    ➢ Eddie starts a new project, alone
    ➢ He decides to version with Git
    ➢ The project become bigger
    ➢ The team become bigger
    ➢ Which Git workflow will he use?

    View Slide

  4. Centralized workflow

    View Slide

  5. Even (GIT) flow | @antodippo | November 2018
    Centralized workflow
    ➢ Good for who’s transitioning from SVN
    ➢ Just one branch, master
    ➢ Just one dev, so no conflicts

    View Slide

  6. Even (GIT) flow | @antodippo | November 2018
    Centralized workflow
    master

    View Slide

  7. Even (GIT) flow | @antodippo | November 2018
    Centralized workflow
    Conflicts!
    Mike

    View Slide

  8. Even (GIT) flow | @antodippo | November 2018
    Centralized workflow
    master
    local Eddie’s master
    ➢ Mike starts working on the repository
    ➢ Eddie is working on the same commit
    ➢ Mike pushes a new commit on master
    ➢ Eddie works on the same file as Mike

    View Slide

  9. Feature branch workflow

    View Slide

  10. Even (GIT) flow | @antodippo | November 2018
    Feature branch workflow
    ➢ Every feature is isolated in its own branch
    ➢ Conflicts must be solved in feature branch
    ➢ When finished it will be merged in master
    ➢ Eddie can control what’s going on with
    pull requests

    View Slide

  11. Even (GIT) flow | @antodippo | November 2018
    Feature branch workflow
    master
    Mike’s feature
    merge/rebase
    pull request

    View Slide

  12. Even (GIT) flow | @antodippo | November 2018
    Feature branch workflow
    Application must be deployed!

    View Slide

  13. Feature branch workflow
    and continuous delivery

    View Slide

  14. Even (GIT) flow | @antodippo | November 2018
    Continuous delivery workflow
    ➢ The application must be delivered in
    production in short cycles, with new
    features and bug fixing
    ➢ There will be many environments
    (development, staging and production)
    ➢ Anything on master branch must be
    deployable in production at anytime

    View Slide

  15. Even (GIT) flow | @antodippo | November 2018
    Continuous delivery workflow
    ➢ One “integration” branch for each
    environment (develop, stage, master)
    ➢ New feature (or hotfix) branches start from
    master
    ➢ A feature (or hotfix) branch can be merged
    in one of the integration branches
    ➢ When a feature (or hotfix) branch is ready
    for production there will be a pull request
    to master

    View Slide

  16. Even (GIT) flow | @antodippo | November 2018
    Continuous delivery workflow
    master
    feature
    develop
    stage
    merge/rebase
    pull request

    View Slide

  17. Even (GIT) flow | @antodippo | November 2018
    Continuous delivery workflow
    ➢ Start a new branch always from
    master?
    ➢ Pull requests to environment
    branches too?
    ?

    View Slide

  18. Even (GIT) flow | @antodippo | November 2018
    Continuous delivery workflow
    X

    View Slide


  19. We will have fixed release
    cycle, and we will maintain
    n releases

    View Slide

  20. Gitflow workflow

    View Slide

  21. Even (GIT) flow | @antodippo | November 2018
    Gitflow workflow
    ➢ Made popular by Vincent Driessen (nvie)
    ➢ Suitable for fixed releases cycle projects
    ➢ Specific role for each branch
    ○ develop and master
    ○ feature/hotfix branches
    ○ release branches
    ➢ Command line tool: https://github.com/nvie/gitflow

    View Slide

  22. Even (GIT) flow | @antodippo | November 2018
    Gitflow workflow
    master contains the release history, with tags
    develop contains the complete history, and it’s the
    integration branch for new features
    feature branches
    branch off of develop
    are merged back into develop

    View Slide

  23. Even (GIT) flow | @antodippo | November 2018
    Gitflow workflow
    release branches
    branch off of develop when a release is (almost) ready
    are merged into master and tagged when is ready
    hotfix branches
    branch off of master
    are merged into develop (or the release branch)
    are merged into master (tagging)

    View Slide

  24. Even (GIT) flow | @antodippo | November 2018
    Gitflow workflow
    https://medium.com/devsondevs/gitflow-workflow-continuous-integration-continuous-delivery-7f4643abb64f

    View Slide

  25. Even (GIT) flow | @antodippo | November 2018
    Mike new feature and bug fixing process:
    1. Mike branches feature/new-feature off of develop
    2. Mike works on his branch getting updates from develop sometimes
    3. Mike submit a PR to develop and Eddie merges the PR
    4. When the new release is almost ready, Eddie branches off
    release/1.x of develop
    5. Eddie merges release/1.x to master tagging with the release number
    6. After some time, Eddie report a new bug to Mike
    7. Mike branches hotfix/new-bug off of master
    8. Eddie merges hotfix/new-bug into master, tagging
    9. Eddie merges the hotfix/new-bug into develop and release/1.x
    Gitflow workflow

    View Slide

  26. Even (GIT) flow | @antodippo | November 2018
    Gitflow workflow
    ➢ Hotfix must PR to master?
    ➢ Is develop a release branch?
    ➢ When release branches must be
    deleted?
    ?

    View Slide


  27. We must open source
    this project!

    View Slide

  28. Bonus: forking workflow

    View Slide

  29. Even (GIT) flow | @antodippo | November 2018
    Forking workflow
    ➢ Developers who wants to contribute fork
    the main repository, instead of cloning
    ➢ They start a new feature branch in their
    forked repository
    ➢ They make a PR to the original repository
    ➢ Eddie merges the PR in the original
    repository
    ➢ Developers pull the changes in their
    forked repository

    View Slide

  30. Even (GIT) flow | @antodippo | November 2018
    Thanks!

    View Slide