Git workflows refer to the different approaches or strategies that teams can adopt when using Git in their software development projects.
Gitflow is a git branching model that involves the use of feature branches and multiple primary branches.
Let’s review the original publication of GitFlow model by Vincent Driessen at nvie.
The Trunk Based Git Workflow is a development approach where all developers work on a single branch called the trunk
or main
branch.
It encourages small, frequent commits and emphasizes continuous integration and delivery (CD).
This workflow promotes collaboration and reduces integration issues but requires strong automated testing and a high level coding skills of team members.
Here is the workflow:
main
, then push their work to remote. Developers may create a short-lived feature branch to test their work locally. The main
branch is always assumed to be stable, without any issues, ready to be released in any moment.main
into to release
branch. A few more changes might be committed before the release is ready.It’s important to be flexible when choosing a Git workflow and not be overly rigid with specific methodologies like Gitflow or Trunk Based Development. As a DevOps engineer you will be entitled to design the workflow that suits the specific needs and dynamics of your team, project, and development processes.
Let’s see another workflow that combined both Gitflow and trunk-based, we call it env-based. This is the workflow that will be used in course’s projects.
Here is the workflow:
main
branch into their feature branch.dev
branch, and push to remote.main
(not directly, but through a Pull Request).main
branch can be deployed to production environment directly after the merge.