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.

  • Published 17 May 2023
  • 5 mins read
A guide to Salesforce Git version control
Table of contents

Article Highlights

  • The article discusses the importance of using version control systems like Git for Salesforce development, highlighting the ability to identify errors, roll back changes, and maintain progress records.
  • It explains the standard workflow of Git for Salesforce, which involves committing changes to a local repository and then pushing them to a remote repository for collaboration.
  • The article introduces Hutte, a visual tool that simplifies Salesforce version control by providing a web UI integrated with Git hosting tools, eliminating the need for command-line interface knowledge.

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 like Git, teams can experiment with different features or approaches without risking 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 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, meaning 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 and separate lines of development that allow developers to work on features or fixes independently. Once the work is complete, developers can merge their changes 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, so commits are quick and lightweight.

Open-source

Git is open-source, meaning 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. To effectively use the SFDX Git workflow, users must be familiar with Git concepts such as branches, commits, merges, and pull requests.

This can be a barrier to entry for new users who are unfamiliar 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 make it harder to track changes and troubleshoot issues, especially for users unfamiliar with the Git command line.

Leverage the benefits of visual Git-based development with Hutte

At Hutte, we enable you to visually leverage the benefits of Git-based development without needing 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, meaning no hassle is 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.

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

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 your issue tracking system (such as Jira). Once you’ve named the org, your environment will be 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 part of your environment.

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

You can make any change you desire with access to the data model. 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 your actions and select what to include from the changes you committed. Then, click on “Submit.”

This will create your SFDX pull request, and your changes will get added to 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 for 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.

Git-based development statistics

Last updated: 26 Jun 2024