I keep reading how people are forgoing the develop
git branch and doing all work on master
- and how this makes everything simpler.
I tried it:
- I have a master branch (with linear history) and many short-lived feature branches.
- I merge features into master.
- To release, I tag a commit on master - e.g.
staging
or1.2.3
- to trigger my CI/CD tool to produce a staging or production release, respectively.
That works nicely... until one needs to release a hotfix.
Suppose I prepare a hotfix and merge it into main. There would be feature commits (feat
) between the last stable release (1.2.3
) and the hotfix (hotfix
) - and if I deploy that last commit, it'll include all those miscellaneous features as well:
1.2.3 <-- feat <-- feat <-- feat <--hotfix
That's asking for trouble.
How does one deal with hotfixes in such a workflow?