r/git • • Jun 23 '26

support How to improve our deployment process?

Hi,

I need help on how we can improve our deployment process.

We use a three‑branch workflow:

  • dev → integration branch where feature branches are merged
  • qa → staging/testing branch
  • main → production branch

The process is: once a feature branch is merged into dev, we open a pull request from dev into qa. For production releases, we then create a PR from qa into main.

We deploy every two weeks. The issue is that qa sometimes contains changes that aren’t ready for production. When preparing the PR from qa → main, we end up having to revert commits that shouldn’t be released yet. Later, when those features are finally ready, they don’t show up in the next PR because Git considers them already merged. To re‑introduce them, we have to perform a revert of the revert (similar to the process described in this article).

Is there a better way for us to do this without losing the direct PR creation from qa → main?

5 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/DrMaxwellEdison Jun 24 '26

So you're advocating for almost no branching whatsoever? That sounds much riskier. There's a difference between your "needing" to break the build and development that may break the build (and require independent testing to ensure it does not).

Trunk-based does imply short-lived branches that reintegrate and are then discarded, and feature branches fit that criteria. Release branching can be an added requirement for businesses that need to release in intervals, isolate releases for QA, sign off on them with stakeholders, etc. You see this often in financial institutions where change control is regulated. They should not be that long-lived, though: once done, probably within a couple days' time, they can be reintegrated and discarded.

Git flow, specifically, implies two long-lived branches that are never discarded, with main tracking the production version and develop tracking "next release". But the requirements that lead to that design can be met with the temporary release branches, tags, etc.

So the ideal is trunk-based, keeping one long lived branch. Adjust as needed for your org's needs. I'm speaking from my own experience in orgs that need a release cadence to coordinate properly.

1

u/emaxor Jun 24 '26 edited Jun 24 '26

I'm not personally a fan of trunk, but yes it advocates for no release branches. Ever. Even if you plan to delete the release branch.

Once you start getting into release branches you have multiple lines of development. Where 1 line does not know about changes in the other. Not saying that isolation is wrong, but it is Certainly not trunk.

Trunk is 1 line, not 2. Planning to delete the extra line in the future does not erase the sin.

The same logic applies against feature branches. Even if the extra lines are short lived, for the time period they exist everyone else is not integrated with your commits. You may have to deal with others stepping on your toes every time you merge in the latest from trunk to a feature. How can they avoid stepping on toes that don't exist in trunk yet?

Right now trunk is the buzzword of the month. Everyone wants to say they do trunk. Meanwhile they practice multiple lines of development, full isolation. not wrong or bad, but not trunk.

Same thing happened in the "agile" era when that was the cool new developer trend. Labeling things agile became more important than agility.

1

u/wildjokers Jun 25 '26

Trunk-based does imply short-lived branches that reintegrate and are then discarded

So the original definition of trunk-based development was indeed no branches at all, just work from trunk and merge directly into it. This can actually work for small teams.

Trunk-based evolved into short-lived feature branches since it scales to bigger teams.

Both are now considered trunk-based development:

https://trunkbaseddevelopment.com

1

u/LorenTheAdult Jun 28 '26

If there is no branches then what are you merging directly into trunk from? Or do you mean push directly to trunk?

1

u/wildjokers Jun 28 '26

One variant of trunk based development is you push directly to trunk.

1

u/LorenTheAdult Jun 28 '26

What’s the method for reviews then?

1

u/wildjokers Jun 28 '26

🤷‍♂️