A CI/CD strategy needs to allow different developers to integrate changes continuously while preserving application stability and maintaining a controlled deployment process.

One approach is to combine Trunk-Based Development with release branches, using pull requests, automated checks, acceptance testing, and artifact promotion.

This model allows development to continue on the main line while specific versions are prepared, tested for acceptance, and deployed.

1. Branching strategy

main serves as the primary integration line, receiving reviewed and validated changes. It does not necessarily represent the version deployed in production.

One possible convention:

Branch or tag Responsibility
main Continuous integration of changes
feature/123-descricao Feature development
bugfix/124-descricao Regular fixes
refactor/125-descricao Bounded refactorings
release/1.8 Acceptance testing and maintenance of a given version
hotfix/126-descricao Urgent fixes
v1.8.0 Identification of an approved version

Working branches normally start from validated main and should be short-lived.

After pull request approval and mandatory checks, changes are integrated into the main line.

Release branches are created from specific main commits, allowing a version to be stabilized while new development continues.

This approach is compatible with the Release Flow concept documented by Microsoft, although each organization can adapt its conventions.

Further reading: Microsoft — Release Flow · DORA — Working in Small Batches

2. Continuous integration and pull requests

Frequent integration reduces accumulated changes and makes incompatibilities easier to identify.

Before merging, the process should apply project-established checks, such as build, tests, static analysis, and review.

A main protection configuration may require:

  • Pull requests to integrate changes.
  • Approval by authorized reviewers.
  • Completed automated checks.
  • Reassessment after relevant changes.
  • Restrictions on direct changes to the protected branch.

Merge queues and concurrent changes

When several pull requests are ready for integration, a merge queue can check their combinations before merging.

For example, two PRs may pass individually but introduce incompatibilities when their changes are combined.

The queue checks the state to be integrated, reducing the likelihood of introducing problems detectable by configured checks.

However, the merge queue can also become a bottleneck when pipelines are excessively slow.

The process needs to balance integration frequency, number of checks, and execution capacity.

Further reading: GitLab — Merge Trains · GitHub — Merge Queue

3. Incremental development and Feature Flags

Large features do not need to remain on isolated branches until fully implemented.

An alternative is to divide implementation into increments compatible with existing behavior.

Techniques such as Feature Flags, Branch by Abstraction, and Expand and Contract allow changes to be introduced progressively.

For example, a feature can be prepared in stages:

  1. Introduce an optional field in the API.
  2. Implement frontend support without activating the new behavior.
  3. Validate compatibility between components.
  4. Activate the feature when ready.
  5. Remove temporary mechanisms when no longer needed.

The goal is frequent integration without releasing incomplete features to users.

It is important to note that Feature Flags do not fix structural incompatibilities, destructive migrations, or failures preventing application startup.

Further reading: Martin Fowler — Feature Toggles · Branch by Abstraction · Parallel Change

4. Preparing the release

When a version is ready for acceptance testing, select a main commit that passed the necessary checks.

Create the release branch from that point.

main
 ├── feature/A ── merge
 ├── bugfix/B ─── merge
 ├── approved commit ───── release/1.8
 └── new development continues

The release contains all changes present in the selected commit.

New main commits do not automatically enter this version.

During acceptance testing, the release branch should receive only fixes necessary for version stabilization or maintenance.

These fixes need to be propagated to other relevant lines to prevent the same problem from reappearing in future versions.

There is no need to manually cherry-pick dozens of features to assemble each release. The usual flow uses an integrated, validated point on main.

5. Builds, artifacts, and acceptance testing

Deployment should use identifiable artifacts associated with the code version that produced them.

Depending on the technology, the artifact may be a Docker image, executable, or package prepared for execution.

The procedure can follow this sequence:

  1. Build the release candidate.
  2. Identify the artifact and corresponding commit.
  3. Install the artifact in the acceptance environment.
  4. Run necessary checks.
  5. Approve the version or fix problems found.

If a change is necessary, a new candidate should be produced and validated according to its impact.

It is also important to distinguish the development environment from the production build.

An application may work during development and have problems when executed with production configurations and optimizations.

The artifact that passed acceptance testing should be the same one promoted to production, avoiding differences introduced by new builds.

Configuration compiled into the frontend requires special attention. When build variants exist, they need to be identified and validated separately.

Further reading: Google SRE — Release Engineering

6. Tags and production deployment

After acceptance testing, a tag can identify the commit corresponding to the approved version.

For example:

release/1.8
    |
    └── v1.8.0
            |
            └── Production deployment

The pipeline configured to recognize this tag pattern can initiate deployment.

A tag does not perform a deployment by itself. It serves as a reference and potential automation trigger.

The process should:

  • Confirm the version was approved.
  • Identify the artifact that passed acceptance testing.
  • Promote that same artifact to production.
  • Record version, configuration, and result.
  • Check application health after deployment.

When infrastructure allows, deployment can be gradual, using strategies such as Canary or Blue-Green.

Specific deployment and recovery mechanisms are covered in the series Deployment: three scenarios and how to choose.

Further reading: Microsoft — Safe Deployment Practices

7. Fixes, hotfixes, and recovery

Regular bugs follow the normal development flow.

For production incidents, the first step is to assess whether a faster and safer way exists to contain the problem, such as disabling a feature or returning to the previous version.

When a fix needs deploying:

  1. Identify the affected version.
  2. Prepare a minimal change.
  3. Prefer fixing on main and porting the fix to the affected release.
  4. When urgency requires a direct fix to the deployed version, ensure the equivalent change is subsequently made on main.
  5. Run necessary checks.
  6. Generate and acceptance-test a new artifact.
  7. Publish a new tag, such as v1.8.1.

The recovery strategy needs to consider application specifics.

Code rollback does not mean data rollback.

Schema changes, external operations, and incompatible migrations may require additional recovery or compensation procedures.

Database evolution should therefore consider version compatibility whenever necessary.

Further reading: AWS — Ensuring Rollback Safety During Deployments

8. Adapting the process to scale

Pipeline complexity should match project needs.

Scenario Strategy
Small projects Short-lived branches, PRs, CI, tags, and releases when necessary
Growing teams Branch protection, automated checks, acceptance testing, and controlled integration
Many concurrent changes Merge queues, pipeline parallelization, and dependency control
Multiple services Versioned artifacts, contracts, and coordinated deployment strategies
Large scale Caches, incremental builds, distributed execution, and Git infrastructure optimization

Git remains an appropriate option for a large share of projects.

Features such as Git Worktrees, partial clone, and sparse checkout can help with different needs, including parallel execution and reducing transferred file volume.

At extreme scales, Git storage and processing infrastructure may also need to evolve.

However, specialized solutions for large organizations should not be treated as requirements for smaller teams.

Further reading: Git Worktree · Git Partial Clone · Git Sparse Checkout

Conclusion

A development and continuous delivery strategy should allow frequent integration, controlled acceptance testing, and deployment of identifiable versions.

Combining Trunk-Based Development, Release Flow, automated checks, versioned artifacts, and recovery mechanisms provides a foundation adaptable to projects of different sizes.

The goal is to keep development moving while approved versions are prepared and deployed, reducing conflicts and preserving the ability to recover the system when necessary.