Resolving Merge Conflicts in Salesforce

Salesforce teams face code clobbering and loss of metadata due to complex sandbox strategies. Git solves this with backup and merge conflict handling. Blue Canvas offers automatic syncing and 1-click conflict resolution for faster development.

Last Update:
Published:
August 21, 2017

With this article, learn how using Git for Salesforce can solve code clobbering and handle merge conflicts seamlessly. Also discover Blue Canvas in practice: a simple and automatic Git implementation for Salesforce that can help with merge conflict detection and resolution.

Here are 5 Key Takeaways from this blog:

- Git is a great tool for Salesforce developers because it provides a backup of every change and the ability to revert to previous snapshots of your code base.

- Git is designed to handle merge conflicts, which can be a common issue when multiple people are working on multiple features in multiple sandboxes.

- Blue Canvas is a simple and automatic Git implementation for Salesforce that can help with merge conflict detection and resolution.

- With Blue Canvas, every change is automatically committed into Git continuously, ensuring that even quick declarative or UI based changes to Workflows or Fields get added into the Git repo.

- Automatic merge conflict detection allows Salesforce developers to move much faster and focus on building great tools instead of managing spreadsheets. Learn more about Merge Conflict Resolution functionality.

Table of Contents

Code clobbering is a pain. But as Salesforce sandbox strategies get increasingly complex it can be difficult to avoid. Many teams have multiple people working on multiple features in multiple sandboxes. Some resort to spreadsheets to manage the chaos. But still, even with spreadsheets, it can be all too easy to push a change set that overwrites the code of a colleague or causes you to lose some important metadata. One team we work with lost nearly 6-months of developer time due to an inadvertent push to a sandbox. They had no source control and no backup of their Salesforce code. This can costs tens of thousands of dollars.

Git is wonderful because it solves code clobbering. First of all it gives you a complete backup of every change and the ability to revert to previous snapshots of your code base. So whenever you push a change, all is not lost. Instead you have a continuous history of who is changing what and when.

But Git is also designed to specifically handle merge conflicts. Because Git keeps a comprehensive history, it can detect when changes happen in one branch that conflict with changes in another. When you go to merge these branches, instead of just overwriting one with the other, Git raises its hand and asks “Are you sure?” Even more useful, Git will show you the exact lines of code that are different and let you “resolve” the conflict by selecting which you want to use.

One of the best things about using Git for Salesforce is that you can handle merge conflicts seamlessly and combat the tendency for work done on one sandbox to overwrite the work done on another (Note: You can even sometimes overwrite yourself! We have heard stories of one person teams overwriting work that they made on a previous sandbox accidentally).

Because Blue Canvas is a simple, automatic, easy to use Git implementation for Salesforce, it makes handling merge conflicts very simple.

Automatically Sync all Salesforce Changes to Git

With Blue Canvas, every change is automatically committed into Git continuously. This ensures that even quick declarative or UI based changes to Workflows or Fields get added into the Git repo. This happens whether it’s a sandbox or production. And it’s crucial because it allows Git to do it’s job. Without automatic syncing you might have certain types of metadata slip through the cracks.

Resolved Merge Conflicts with 1 Click

If a change occurs in two connected orgs, Blue Canvas will detect this and notify you when you try to merge the branches.

Merge conflict error


Get started now with Salesforce Continuous Integration

Our developer tooling helps you compare Salesforce orgs within seconds, can merge changes from multiple sandboxes into one, and backs up your Apex and metadata changes on a continuous basis!

Blue Canvas even includes a slick user interface for handling the merge conflict. It will show you what is present in each org and let you quickly select which version you want to use with the click of a button (or custom edit the file if you prefer). This works with both code and declarative changes:

Merge conflict UI


You can then resolve these conflicts and continue with your deployment.

Move Faster with Merge Conflict Detection

Automatic merge conflict detection allows Salesforce developers to move much faster. When you trust your source control and CI system to catch merge conflicts, you can drop the spreadsheets and focus on actually building great tools. To gain access signup at https://bluecanvas.io.

More like this