Git Snapshot

Updated 2 months ago by Iván Minaya

Git Snapshot Overview

A Git Snapshot record in Copado defines a connection between a Salesforce Org with a Git Repository/branch.  Once that connection is established, git snapshots can be used for the following

  1. Take a Git Snapshot. This is a full backup of the selected metadata types into the Repository/branch.
  2. Commit files. This is a partial snapshot, where only selected files will be committed to the Repository/branch.
  3. Retrieve commits information into Copado. If you are using Git outside Copado, this function will allow you to retrieve all commit data into Copado so that it can be used to Deploy from Git, using Git MetaData steps, or compare metadata files using the Snapshot Difference functionality.

Creating a Git Snapshot record

  1. Click on the tab, Git Snapshots.
  2. Click New
  3. Fill in all required fields, selecting your Git Repository and Salesforce Org. By default the master branch is selected, but this may be changed to a branch of your choice.
  4. Select the backup frequency. Available frequencies are, DailyWeekly and Monthly.
  5. Click Save

Taking a Snapshot

  1. Select an existing Git Snapshot.
  2. Click "Create Snapshot Now"
    1. As of v12 "Take Snapshot Now"
  3. Optionally enter a commit message.
    1. As of v11,  you have the option to apply Environment Variables and Global Find and Replace rules (YAML) in the Snapshot. The YAML file is taken from the Deployment Flow . If there is no YAML in the Deployment Flow,  it will be taken from the Environment.

With the frequency set, Copado will automatically back up your Salesforce Org.

Commit files

By moving commits into the cloud, we are eliminating the headache of doing git pull / refresh from server to keep your local code, local git repository, the online git version and the Salesforce online code version in sync.  Non-technical users will also find it easier to commit their work into a Git Repository. We recommend using the Salesforce Developer Console to code in the cloud and Copado cloud commit is the perfect companion.

  1. Select an existing Git Snapshot.
  2. Click "Commit Files"
  3. Select files to be committed and enter a commit message.
    1. You are able to select nested components, such as Custom Fields or Validation Rules, Copado will retrieve those components and merge them into the container file, e.g. Account.object
    2. You are able to select nested permissions, such as Custom Field + Profile, Copado will retrieve those permissions and merge them into the container profile or permission set, e.g. Admin.profile

As of v11, the commit files page offers more Git Operations, click here for more information.

 Retrieve commits

  1. Select an Git Snapshot.
  2. Click "Retrieve Commits"
  3. Wait a few minutes, reload the page and all commits will be displayed on the Commits related list.

Advanced Metadata Filter

This allow you to limit the Metadata types to be included in the Snapshots. For example, if you only need to track Code on Git, you can select ApexPage, ApexClass, ApexComponent and StaticResource. Even if you need to backup all your metadata, you might want to exclude, Documents, or Reports or Roles or Groups, which on big Organizations has a lot of items and does not add too much value to the backup.

Static Resources to be Unzipped

This functionality allows you to choose which zipped static resources to be unzipped before being committed to the Repository.  

This will enable you to version the files within a Zip file. JavaScript/CSS files within static resources will have the same traceability as apex code! 

Using a .gitignore file to exclude files

The use of .gitignore files is supported by the Copado Git Snapshot process. A .gitignore file can be used to exclude files from a repository, this is particularly useful when using Git Snapshots together with Copado Continuous Integration to create automated builds and exclude files that don't have to be deployed to the destination org. Make sure that excluded files are not in the repository before using the .gitignore. More information about .gitignore files can be found here.

Git Snapshot Field Set

As form Copado v7, with this new Field Set you can customize the information shown in the Git Snapshot, in the "Other information" section:

How did we do?