26
YAGBW - Yet Another Git Branching Workflow
Hey guys! Andou here, backend engineer / web developer / tech leader for Bitmama Reply, an Italian web agency headquartered in Milan, Turin and London.
In this article I would like to talk to you about YAGBW - Yet Another Git Branching Workflow, the git branching workflow we usually work with.
Let's get started!
When you decide to version control your project (and you should do) using git, you are somewhat asked to choose a branching model or workflow.
I've listed the most common workflows in my tech resources list, which are:
Well, without further ado, here is the branching workflow we usually adopt to handle our web projects with minor headaches and a pretty full control over delivered features.
This is a solution somewhere between Git Flow and GitHub Flow.
Basic rules:
master
(or main
) branch and a cert
branchmaster
(or main
)cert
cert
on master
(or main
)Developing stuff:
feature/<name>
for a feature and hotfix/<name>
for a bug resolutionmaster
(or main
)cert
to have it testedmaster
(or main
)master
(or main
) in your feature branch on a regular basis
.Deploying stuff (assuming you have at least a production and a certification environment):
cert
could be deployed at any given time on your certification environmentmaster
(or main
) could be deployed at any given time on your production environmentcert
master
(or main
)Of course the above workflow should perform well or not given the nature of the project you use it with. You may find yourself comfortable with some addons on the process:
Speaking of web projects there's always an initial phase where you are not online with your project and the word CI/CD makes no sense at all.
During this phase you may consider to merge and test directly on
During this phase you may consider to merge and test directly on
master
(or main
).You may find yourself comfortable introducing PRs to merge feature branches on
cert
and on master
(or main
). It's up to you, but it may helps to control your flow.Well, this is not really an addon because I strongly recommend it. Consider to make an annotated TAG for every merge on
This really helps with rollbacks.
cert
and on master
(or main
). This really helps with rollbacks.
Remember you can always detach a new branch from a previous tag (
git checkout -b newbranch yourtag
).That's all for today. I hope this has been an helpful read. Please comment with your suggestions and feedback. Also, let me know what you think about our branching workflow and if you have some other addons we should consider introducing.
26