Why Salesforce Source Control Is Important for Team-Based Development

ClickDeploy Team
5 min readMar 18, 2020

--

As a member of a busy and growing Salesforce development team, there’s a good chance you’re considering adding source control to your release process. To help you make that decision, let’s go through the basics of source control and its uses for team-based development efforts.

Challenges and Limitations Faced by Salesforce Development Teams

If you are not currently using a source control system to store and manage your development code, you may be grappling with some of these common challenges and limitations:

  • You don’t have a comprehensive version history of every change that’s been made to your code through the course of a project.
  • If something goes wrong during a deployment, there’s no way to roll back the target org to an earlier working state.
  • Team members sometimes overwrite one another’s work with conflicting code or configuration changes.
  • There’s no easy way to clone or merge changes from multiple source orgs for deployment to the target org.
  • You’d like to deliver faster and more frequent releases to your customers, but the inefficiencies and bottlenecks in your current workflow prevent you from doing so.

Benefits of Using Salesforce Source Control

Source control, also known as version control, is a system for tracking and managing all of the changes that a development team makes to the code in its codebase. With a source control management (SCM) repository, teams can access a complete history of code development and coordinate work by multiple contributors over the course of a release cycle.

Git is a popular SCM system used by many DevOps teams today. Git was invented by Linus Torvalds in 2005 to support the development of the open-source Linux kernel. The challenges that confronted Torvalds and his community of Linux collaborators were the same ones faced universally by programmers working in teams, and Git was designed with the specific needs of team-based developers in mind.

In the following sections, we’ll explore some of the many benefits that Git can bring to your team’s Salesforce development flow.

A Single Source of Truth

Git is a distributed source control system, which means that every developer on a team can keep a copy of the entire code repository on their local machine. Typically, developers work locally on their changes to the code using their favorite integrated development environment (IDE) and then sync their local copy of the repository with all the updates made by their collaborators. This way, everyone has constant access to the latest codebase collectively authored by the team.

If Git functions as the application that drives the fundamentals of source control management, how do team members share their work and communicate with each other? That’s where a Git collaboration platform comes in. Online collaboration platforms like GitHub, GitLab, BitBucket, and Azure DevOps function as hosts for a Git repository that extend the collaboration capabilities of Git with support for things like team discussions and a well-defined code review and approval process.

With Git for source control management and a collaboration platform for developer coordination, project teams can encourage an ethos of transparency and discipline around source code. They can also implement a range of Salesforce version control best practices.

One best practice involves adding a third-party deployment solution to a streamlined DevOps toolchain that includes the Git repository and the Salesforce orgs representing the final targets of deployment. In the new workflow, admins and developers can no longer deploy their code and configuration changes directly to an org. Instead, they must first commit their changes to Git and make a pull request to initiate the review workflow along with an automated check for any code conflicts. Only when a change is fully approved by the team can it get pushed to the target org. This gating process reinforces Git as the team’s source of truth and reduces the risk of accidental code overwrites.

Code Branching

The ability to create different branches of code lies at the heart of source control management. It allows team members to develop and test new features in parallel without disturbing the master code branch that represents the production org. At the start of a project, the team typically creates these branches in their Git repository:

  • Master, for the configuration of the production org
  • UAT, for the configuration of the test sandbox

In addition, each developer or admin creates an offshoot feature branch to which they commit the incremental changes that are ready to be tested.

Merge and Clone

In Git, cloning the metadata configuration of an org is as simple as duplicating a code branch and fine-tuning it with the necessary customizations.

Similarly, merging can be accomplished by consolidating two or more branches. For example, a team lead can merge approved feature branches from different developers together with the UAT branch to create an updated build for testing.

Save and Revert to Prior Versions

Git saves distinct versions of the repository at given points in time and maintains a log of every single commit made to the repository. You can easily revert a code branch to any of its prior versions at any time. In the context of a Salesforce deployment, this capability means that you can effectively restore an org to a prior configuration state.

Suppose that the team discovers a critical issue with a feature that has already gone live in the production org. How can they mitigate this situation before the customer stumbles across the one use-case that will break the feature?

With Git, the team lead can simply revert the production branch to the last version before the problem feature was incorporated, and then deploy the reverted code to the production org to restore the customer’s working environment. The team can continue to develop and integrate bug fixes and code changes with peace of mind, knowing that they can implement version control in Salesforce.

Accelerated Release Cadence

Salesforce source control empowers teams to make the paradigm shift from waterfall development to a process of continuous integration (CI), where batches of code are integrated, tested, and deployed to production in smaller and more frequent intervals. Development and testing of different code batches can happen safely in parallel, as Git manages the various feature branches and a third-party DevOps tool automates the schedule of deployments. A CI workflow can greatly streamline your team’s efforts and enable you to deliver better value to your customers at faster rates.

Try ClickDeploy

ClickDeploy Enterprise is a cloud-based DevOps tool that lets you deploy your Salesforce customizations at scale with lightning speed. ClickDeploy supports tight integrations with industry-leading Git collaboration platforms such as Github, Gitlab, BitBucket, and Azure DevOps so that you can bring all the benefits of source control to your deployment workflows.

To explore team collaboration and sharing with ClickDeploy and Git, use your Salesforce login to sign up for a free three-week trial.

--

--

No responses yet