Skip to main content

Using conflict replay to quickly resolve conflicts in Pipelines

Using Gearset's conflict replay to help you resolve conflicts you've seen before

Written by Sam Wilson

When you commit conflict resolutions for a PR in Gearset, we store a fingerprint of each conflict, along with the resolution you chose. The fingerprint is made up of a hash of the conflicting content and the commit SHA at the head of your feature branch.

As you then move this PR down the pipeline, the system will look at any stored conflict resolutions from earlier environments and suggest resolutions for matching conflicts.

Gearset conflict resolutions with suggested conflicts selected

The matching conflicts found will be pre-selected in the conflict UI. You will have the opportunity to review these suggestions and, if required, change them prior to committing the resolution.

When will Gearset suggest a resolution?

Conflict replay is deliberately conservative. We'll only suggest a previous resolution when both of these are true:

  1. The head of your feature branch is the same commit as when you resolved the conflict before.

  2. The conflicting content is an exact match for the conflict you resolved before.

In practice, this means the PR needs to be promoted unchanged, and in the same order relative to other PRs, as it was in the earlier environment.

Accepting suggested resolutions

Resolve your conflicts

I've worked on a new feature that contains some Apex code. This has resulted in a conflict against my Staging static environment.

I'll use Gearset's conflict resolution tooling and decided how best to resolve these conflicts.

Accepting suggested changes

I've resolved my changes and promoted them to my next static environment, Production. This was successful, but the changes in my feature conflict with my Production static environment.

Gearset knows that the conflicts are the same as what happened against my Staging static environment, so it will show me a banner and it'll automatically choose the selections I made before:

I can scroll through the file and check that I'm happy with these suggestions. If I am, I can go ahead and select Mark as resolved and Commit merge.

Amending suggested changes

The suggested changes might not be how you want to resolve your conflicts. You still have full control over the choices you make for each conflict, which means you can select something else instead.

On the top banner, you can disable 'Accept previous resolution conflicts', and the suggested selections will be deselected:

Alternatively, you might only want to change one of the resolution choices. You can change any of your selections in conflict resolution tool.

Note: if you decide on different conflict resolutions for your final environment (which should align to the base branch for your pipeline) compared to prior environments, and then proceed to sync those branches as part of pipeline maintenance, you may find changes appear to merge and deploy.

The toggle will be switched off to show you've selected something other than the suggestion resolutions but everything else remains checked.

Your new selections will also be saved and if we see this range of conflicts again, we'll take your most recent suggestions.

I can't see any suggested resolutions

If no replay suggestions appear, one of the conditions listed here hasn't been met. The most common reasons are:
​

You've pushed new commits to your feature branch. Any new commit changes the head of the branch, so earlier resolutions no longer apply, even if the conflicting lines look the same.
​

PRs were promoted in a different order. For example, if you merged PR A and then PR B into your first environment and resolved conflicts there, but then merged PR B before PR A into the next environment, the conflicts won't match and no suggestions will appear.
​

The conflicting content has changed. If anything in the conflicting section differs, including changes in the target environment from other PRs, the content is no longer an exact match.

Did this answer your question?