
Andrew Hanna

Andrew Hanna

To resolve a Salesforce metadata conflict during a merge, treat the file as XML nodes rather than lines: open the conflicted file, keep both sides' independent changes, drop only the truly clashing edit, then validate the XML and deploy to a scratch org or sandbox before committing. Most Salesforce conflicts are false positives caused by XML ordering, not real disagreements, so the goal is to reconcile, not to pick a winner. Here is how to do it cleanly.
A merge conflict happens when two Git branches change the same file and Git cannot decide which version wins, so it stops and hands the file back to you with conflict markers. On Salesforce that file is almost always declarative metadata stored as XML, a profile, permission set, flow, or layout. Git compares text line by line, and XML does not play nicely with that model.
Three properties of Salesforce metadata make conflicts far more frequent than in ordinary code:
We go deeper on the root causes in why metadata conflicts happen and how to stop them.
<<<<<<<, =======, and
>>>>>>>. Everything above the divider is your
branch; everything below is the incoming branch.
<fieldPermissions> or
<objectPermissions> block is a unit, not the lines around it.
For the discipline of never losing a teammate's change, see how to resolve conflicts without losing anyone's work.
Manual line-by-line merges do not scale. The durable fix is a metadata-aware merge that understands XML structure. A Salesforce-aware Git merge driver compares files node by node, auto-merging anything that changed on only one side and flagging only the genuine clashes; we walk through the setup in how to set up a Salesforce-aware Git merge driver. DevOps platforms take the same idea further: Gearset, Copado, Flosum, and Blue Canvas all ship semantic or smart-merge features that ignore non-functional XML ordering and surface only real conflicts. Serpent applies the same principle inside GitHub-native pipelines, so your team reviews decisions, not noise. Good source hygiene helps too, and managing Salesforce metadata covers the habits that prevent conflicts in the first place: short-lived branches, frequent merges, keeping environments in sync, and giving shared components like profiles a single owner. Browse the full SF Guides library for more, and compare tooling options on our pricing page.
Why does Git flag conflicts when nothing really changed?
Because the Metadata API returns XML elements in non-deterministic order, so Git sees reordered lines as differences even when the actual settings are identical.
Can I just pick one side of the conflict?
Only when both sides edited the exact same node. If the changes touch different nodes, picking one side silently deletes a teammate's real work.
Should I resolve profile conflicts in the profile file?
Where possible, move object and field permissions into permission sets instead of profiles. Smaller, focused files collide far less often.
Do I need a special tool, or is plain Git enough?
Plain Git works for small teams, but a metadata-aware merge driver or a DevOps platform with semantic merge removes most manual work once more than a couple of developers share metadata.
Commitment free!