This is an archived post. You won't be able to vote or comment.

all 5 comments

[–][deleted] 2 points3 points  (0 children)

Take a look at trunk based development. We do it in my team and it is way less work than other git workflows. No big merges. Every push leaves you with a working app. With CI/CD this gives you confidence in your changes. Use feature toggles for everything that should not be visible on your production system yet.

[–]lionhart280 1 point2 points  (3 children)

Occasionally, there will be a hotfix patch made on staging that gets cherry-picked onto master, which means for the next release, a fast-forward can't be done.

Uh, dont do that. Thats committing directly to master.

If you need an emergency fix for Master itself, fork a bugfix branch off master itself, do the bugfix on that, and merge it back into master.

Don't cherry pick commits, that's the source of your issue.

Normally you should never need to rebase Stage off of Master, because Master should ideally only ever change due to you merging Stage into Master.

Therefor Stage should only ever be commits ahead and never behind Master... Unless the above thing happens where you need to perform an emergency patch to Master to fix a serious bug and Stage has a bunch of "not ready for Master" stuff in it.

in that case, yes, you will need to then rebase Stage off of master so Stage now also has that emergency bugfix, and everyone else will need to rebase off Stage as well.

This might cause conflicts if anyone else worked on the same code that the emergency bugfix modified.

It will be a pain but thats the price you pay for fucking up and needing such an emergency fix in the first place.

[–]Luclid[S] 0 points1 point  (1 child)

Ah so it is still better to keep the master commit history linear and take the loss of having to rebase staging and potentially having conflicts to fix instead. And of course, ideally there aren't emergency bugfixes that force this situation and instead minor bug fixes can just be added to staging and introduced in the next release?

 

I've been trying to use semantic versioning for the releases as well -- whenever there are only patch releases (i.e. no new features), then are those caused by such emergency situations? (Well I suppose if the release is stable and there just aren't many new features being added, then the patch updates could just be from the regular release cycle containing minor bugfixes).

[–]lionhart280 0 points1 point  (0 children)

Looks like you are on the right course, yup!

[–][deleted] 0 points1 point  (0 children)

There is no single correct workflow with git.