miscellaneous-slides

git workflows (for subversion projects)

your floor is now clean

 

in the beginning (subversion / trunk based)

 

 

Trunk Based Development

 

in the past (first git experience / feature branches)

 

  • now you have feature branches almost everywhere
  • development is automatically deployed from master
  • production is manually deployed from master
  • releases are manually tagged on master

 

Feature Branches

 

time to review the process …

 

  • for the development environment ci/cd works great
  • for production deployments you still need manual steps

 

  • some features from development get approved slowly
  • other features in development need to be deployed asap!

 

  • for production deployments you still need code-freezes
  • i.e. you still hold back pull requests before deployments

 

  • improve ci/cd for all environments (development, testing, production)

 

evaluate different git workflows … Trunk Based Development

Trunk Based Development

evaluate different git workflows … Git Flow

Git Flow

evaluate different git workflows … GitHub Flow

GitHub Flow

evaluate different git workflows … GitLab Flow

GitLab Flow

evaluate different git workflows … Git Flow (enhanced)

Git Flow (enhanced)

choose a git workflow! problem?

it don't fit!

 

How to Select a Git Branch Mode?

 

Considering Product Type and Release Method, Team Size, Collaboration Maturity:

Product type and release methodTeam sizeCollaboration maturityApplicable branch mode
All (?) None (?)SmallHighTrunk Based Development
Products that support continuous deployment and release, such as Web applications or SaaS products.MiddleModerateGitHub-Flow and TBD
Products with a definite release window and a periodic version release cadence, such as iOS apps.MiddleModerateGit-Flow and GitLab-Flow
Products that are demanding for product quality and support continuous deployment and release, such as basic platform products.MiddleModerateGitLab-Flow
Products that are demanding for product quality and have a long maintenance cycle for released versions, such as 2B basic platform products.LargeHighGit-Flow

 

Considering from the perspective of the number of required release versions:

  • If a product needs to support multiple release versions, use Git-Flow.
  • If a simple product needs to support a single release version, use GitHub-Flow or TBD.
  • If a complex product needs to support a single release version, use GitLab-Flow.

 

GitLab Flow – Best Practices

 

  • Use feature branches, no direct commits on main.
  • Test all commits, not only the ones on main.
  • Run all the tests on all commits (have them run in parallel).
  • Perform code reviews before merges into main, not afterwards.
  • Deployments are automatic, based on branches or tags.
  • Tags are set by the user, not by CI/CD.
  • Releases are based on tags.
  • Pushed commits are never rebased.
  • Everyone starts from main, and targets main.
  • Fix bugs in main first and release branches second.
  • Commit messages reflect intent.

 

What is GitLab Flow? | GitLab

 

GitLab Flow – branch layout

 

gitlab flow – branch layout

 

Advantages

  • Environment branches define the CI/CD pipeline
  • The git history will be cleaner and more readable
  • Ideal when there is a single version in production  

Improving Continuous Delivery with GitLab Flow

  • All code changes flow in one direction (less conflicts)
  • Building new instances for any environment is easy
  • Comparing code from different stages becomes easy