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
- Take a Git Snapshot. This is a full backup of the selected metadata types into the Repository/branch.
- Commit files. This is a partial snapshot, where only selected files will be committed to the Repository/branch.
- 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
- Click on the tab, Git Snapshots.
- Click New
- 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.
- Select the backup frequency. Available frequencies are, Daily, Weekly and Monthly.
- Click Save
Taking a Snapshot
- Select an existing Git Snapshot.
- Click "Create Snapshot Now"
- As of v12 "Take Snapshot Now"
- Optionally enter a commit message.
- 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.
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.
- Select an existing Git Snapshot.
- Click "Commit Files"
- Select files to be committed and enter a commit message.
- 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
- 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.
- Select an Git Snapshot.
- Click "Retrieve Commits"
- 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.
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: