A Guide To Salesforce Git Version Control

Version control manages and tracks changes to a project's codebase, documentation, and other digital assets in SFDX. It allows multiple developers to collaborate on a project while keeping track of every modification made to the code.

A Guide To Salesforce Git Version Control
Table of contents

This makes it easier to:

  • Identify and fix errors
  • Roll back to previous versions
  • Maintain a record of progress.

Without version control, teams are often forced to rely on manual methods of tracking changes, such as creating backups or copying and pasting code into different files.

These methods can be time-consuming and prone to mistakes, leading to a higher likelihood of bugs and code conflicts.

With version control systems, such as Git, teams can experiment with different features or approaches without the risk of losing or breaking the entire SFDX codebase.

What Is Git For Salesforce

Git for Salesforce works via the command line interface (CLI) by providing a set of SFDX Git commands that enable users to manage and version control their Salesforce code.

The SFDX Git workflow follows a standard Git workflow, where changes are made to the local codebase and then committed to a local Git repository.

From there, changes can be pushed to a remote Git repository, such as GitHub or Bitbucket, where other team members can collaborate and review the code.

Here are some reasons why you should consider using Git for your Salesforce version control:

Distributed system

Git is a distributed version control system, which means that every developer has a complete copy of the codebase on their local machine. This allows developers to work on their changes offline, commit changes locally, and then synchronize with the central repository when they have an internet connection.

Branching and merging

Git makes it easy to create branches, which are separate lines of development that allow developers to work on features or fixes independently. Once the work is complete, developers can merge their changes back into the main codebase.

Speed

Git is designed to be fast and efficient, even with large codebases. It uses a sophisticated algorithm to track changes, which means that commits are quick and lightweight.

Open-source

Git is open-source, which means that it is free to use, and Salesforce developers can customize it to fit their needs.

However, the SFDX Git workflow is limiting because it requires users to have a good understanding of Git commands.

Users must be familiar with Git concepts, such as branches, commits, merges, and pull requests to effectively use the SFDX Git workflow.

This can be a barrier to entry for new users who are not familiar with Git, and it can also make it more challenging to collaborate on Salesforce projects with team members who are not Git experts.

Additionally, in the SFDX Git workflow, the lack of visual tools can also make it harder to track changes and troubleshoot issues, especially for users who are not familiar with the Git command line.

Leverage The Benefits Of Visual Git-Based Development With Hutte

At Hutte, we enable you to leverage the benefits of Git-based development visually, without the need for CLI. We have removed the barriers Git can pose as Hutte is a web UI to SFDX that allows for visual Salesforce version control.

🙅🏻‍♂️
You can also create and manage Salesforce scratch orgs and sandboxes. There is no need for code, which means there is no hassle involved.

Furthermore, you don’t need to install or learn Git, as Hutte’s UI is already integrated into Git hosting tools, like GitHub and Azure.

From these hosting providers, you can also view the changes you made, including your pull request in a line-by-line comparison format.

There is no need to reproduce this data as everything is generated and integrated with Hutte.

To get a first-hand feel of how Hutte works, start your free 30-day trial.

If you’re interested in giving Salesforce Git version control a try, take a look at our easy-peasy guide on executing and installing it in a visual way with Hutte.

Take A Scratch Org From The Pool

Once you have created a Hutte account with us, you will start from a fresh environment by taking a scratch org from the pool.

✏️
You can name your org referencing the issue tracking system you use (such as Jira). Once you’ve named the org, you will have your environment in place. 

With Hutte, you don’t need to share your sensitive and confidential Salesforce org credentials manually. You can simply one-click login, and you can then do your work on the platform.

Create New Metadata And Execute Changes

You can create new SFDX metadata in your org. In this coding example, we have selected an Apex class.

You add your logic to the Apex class and save it. This now becomes an addition to your environment.

👀
To create a change, you will go to “Setup.” You will then select “Object Manager” from the dropdown menu located on the left. This is where the data model lives. You will then open up a custom object.

As you have access to the data model, you can make any change you desire. To implement a change to a field, for example, you will select “Field & Relationships.” In this instance, we are changing the “Help Text.”

Once you have added in your help text, you will save it. To view your changes, you will go to the “Changes” tab.

In this example, the changes had the following impact to the org:

  • “MyClass” was added
  • The admin profile was touched by adding a new class
  • The field change was added.

You Can Now Pull Changes

📣
From here, you can describe what you have done, and you can select what you want to include from the changes you committed. You will then click on “Submit.” 

This will create your SFDX pull request and your changes will get added into Git.

Hutte is truly one of the best tools that we use. Product owners, Salesforce solution architects, business analysts — anyone on our team can easily and visually accomplish the tasks that would otherwise take a lot of clicks, time, and coding.

Sebastian Lechner

Product Management Director of IPfolio
Clarivate

Source: Hutte

Get Yourself Up To Speed With Git

The conventional way of installing Git through SFDX or the Git command-line tool, for example, requires more technical steps, which may be complicated to no-code users.

Through using Hutte, anyone can work with Git, make changes, and create pull requests – regardless of their role or knowledge.

So, what are you waiting for – get started with Git development and Hutte today.