Start free
Andrew Hanna

Andrew Hanna

Metadata Conflicts in Salesforce: Why They Happen and How to Stop Them

Metadata Conflicts in Salesforce: Why They Happen and How to Stop Them

Metadata conflicts in Salesforce happen because your org's configuration lives in thousands of XML files, and three things about those files make clashes routine: the Metadata API returns elements in a non-deterministic order, monolithic files like profiles collect edits from unrelated work, and teams merge from sandboxes that have drifted out of sync. Most of the conflicts you fight are false ones, noise rather than real disagreement. You stop them with source tracking, short-lived branches, permission sets instead of profiles, and a metadata-aware merge rather than a raw git diff.

What is a metadata conflict in Salesforce?

A metadata conflict is a merge conflict in the XML files that define your org: objects, fields, Apex, flows, profiles, permission sets, and layouts. It happens when two branches change the same file and git cannot reconcile them automatically. Because Salesforce represents configuration as text, every admin click and every developer commit eventually becomes a line in a file that git has to merge.

The catch is that many of these conflicts are false. Git flags a clash where there is no real semantic disagreement, only reordered or reformatted XML.

Why do metadata conflicts happen in Salesforce?

Four root causes, in rough order of how often they bite:

  • Non-deterministic XML ordering. The Metadata API can return the same profile or object with its child elements in a different order on each retrieve, so two functionally identical files diff as changed.
  • Monolithic files. A single profile holds permissions for every object and field. Two developers touching unrelated objects produce adjacent edits in the same file, and git reads that as a conflict.
  • Out-of-sync environments. When sandboxes and branches drift from the trunk, a merge has to reconcile weeks of divergence at once, and clashes become almost inevitable.
  • Concurrent work on shared components. Apex classes, Lightning pages, and flows that many people edit are conflict magnets.

Which metadata types cause the most conflicts?

Some file types are far more conflict-prone than others:

  • Profiles - the classic offender: huge, monolithic, and edited by everyone.
  • Permission sets - better than profiles, but still shared.
  • FlexiPages and layouts - broad interdependencies across features.
  • Translations and custom labels - many contributors, one file.
  • package.xml manifests - everyone appends to the same list.

How do you prevent metadata conflicts in Salesforce?

  1. Use source tracking and deploy from git. Retrieve metadata into version control, review changes in pull requests, and deploy from git rather than org to org. Salesforce's own Metadata API deployment guidance makes the git-first workflow the baseline.
  2. Keep branches short-lived. Merge to trunk daily so divergence never accumulates into a painful merge.
  3. Favour permission sets over profiles. Splitting access into small, purpose-built permission sets shrinks the blast radius of any single edit.
  4. Assign ownership of shared files. Give profiles, permission sets, and flexipages a single dedicated contributor per change to avoid overlap.
  5. Keep environments in sync. Refresh sandboxes regularly so every branch starts from the same baseline.
  6. Adopt Salesforce DX and unlocked packages. Breaking a monolithic org into modular packages reduces the surface where two changes can collide.

How do you resolve a metadata conflict when it happens?

When a conflict does land:

  1. Confirm whether it is real or false. Reordered XML with identical content is noise, so normalise it and move on.
  2. For a real clash, resolve at the element level, keeping the specific permission or field from each side rather than accepting one whole file.
  3. Deploy the merged result to an integration sandbox and run your tests before it reaches production.

A raw three-way git merge cannot tell reordered XML from a real change, which is why the whole Salesforce DevOps ecosystem has converged on metadata-aware merging. For the full playbook, including how to read a profile diff and what to do with a conflicted Flow, see How to resolve Salesforce metadata merge conflicts without losing anyone's work.

What tools help with Salesforce metadata conflicts?

Several platforms offer semantic or metadata-aware merging that auto-resolves false conflicts and flags only the real ones. Gearset, Copado, AutoRABIT, Flosum, Salto, and Blue Canvas all work in this space, each with a different balance of automation and control. Serpent takes a git-native approach: it reads your metadata contextually, collapses non-functional XML noise, and surfaces only genuine conflicts for a human to decide, so short-lived branches stay cheap to merge.

FAQ

Are most Salesforce metadata conflicts real?

No. Many are false conflicts caused by non-deterministic XML ordering or reformatting, and a metadata-aware merge ignores them automatically.

Why are profiles so prone to conflicts?

A profile is one large file holding permissions for every object and field, so unrelated edits land next to each other and git reads them as a clash.

Do permission sets prevent conflicts?

They reduce them. Smaller, purpose-built permission sets mean fewer people edit the same file, which shrinks overlap.

How do short-lived branches help?

Merging to trunk daily keeps divergence small, so each merge reconciles hours of change instead of weeks.

Can CI/CD eliminate metadata conflicts?

Not entirely, but source tracking, frequent merges, and metadata-aware tooling turn most conflicts into automatic resolutions.

Related Articles

Curious about faster shipping before you dive in? Let's talk

Commitment free!