Add Pipeline Functionality to Handle Environment Refreshes and Branch Realignment
In many Salesforce development workflows, environments (especially static ones like UAT or SIT) are periodically refreshed from production. When this happens, the environment’s metadata and configuration can become out of sync with the branch linked in Gearset Pipelines.
This especially occurs when:
- Changes were made directly in production that didn’t flow through the pipeline, but now exist in the refreshed sandbox.
- A deployment was started partway through the pipeline but never completed to production, leaving partial changes held on branches in the repo.
Currently, the workaround is to manually run a comparison and commit the differences to realign the branch. However, doing this also triggers a CI job unnecessarily, adding extra time to the process. In these cases, no actual feature changes are being deployed the goal is simply to bring the repo branch back into alignment with the refreshed environment.
Ideally, I would like a way for Gearset to re-sync the branch to match the main branch or the refreshed environment directly. While it’s possible to create a new branch to achieve this, that approach causes loss of history and requires additional setup effort.
Proposed Enhancement:
Introduce functionality within Gearset Pipelines to:
- Automatically reset or re-sync the associated branch, API version, and metadata state to reflect what’s actually in the refreshed environment when a static environment is marked as refreshed.
- Provide an option to perform this alignment without triggering CI or deployment actions.
- Optionally trigger an automatic comparison or rebuild of the environment’s baseline for visibility.
This enhancement would help maintain pipeline integrity after org refreshes, reduce manual work, and prevent unnecessary CI job runs when simply re-aligning environments and source control.
