Deployment Step: Git MetaData

Updated 4 months ago by Copado Solutions

This article is part of the Deployment Steps.

The Git MetaData deployment step lets you deploy contents from a Git commit to an org using the Metadata API.

When this deployment step is executed, Copado retrieves the selected metadata from the Git repository and deploys it to the destination organization. 

To create a Git MetaData deployment, follow these steps:

  1. Navigate to the Deployments tab and create a new Advanced (multi-step) deployment.
  2. Give your deployment a name and select a source and a destination organization.
  3. Add a new step and select Git MetaData as step type:

  1. Select a commit from the Commit Id lookup field:

To make the search easier, you can filter the commits grid by repository or branch name, or search directly for a commit Id. Click on the commit you want to deploy to select it.

Back in the deployment step screen, you will see that the Git Repository, the Commit Name and the Branch fields have been populated with data related to the selected commit:

  1. The grid with all the components related to the commit selected in the previous step will be displayed. Select the components you want to deploy.
When you deploy a commit, the version of the files that is deployed is the version of the files at the time of the commit. If you made any changes afterwards, those will not be deployed.
  1. If your commit contains Apex components, you can specify the test level you want to apply to the deployment:
  • No Test Run (no Apex tests are run unless it is a production deployment).
  • Run Specified Tests (only included apex test classes will run, aka fast deploy).
  • Run Local Tests (all Apex test classes excluding managed packages are run).
  • Run All Tests In Org (all Apex test classes including managed packages are run).

For more information regarding test levels check out the article Apex Tests Run While Deploying.

  1. Find and Replace in files allows you to find a specific text inside the metadata files using a regular expression for matching and replacing matching pieces with a given text. Use cases for this feature are countless, examples can be found in the article about the metadata step.
  2. Once you are ready to execute the deployment click on Deploy and then on Deploy All.

 It's also possible to create a deployment directly from a Git repository, please refer to the Git Repository Overview article for more information.

Use Cases

  1. A good example of when to use this type of deployment step is when you do a sandbox refresh. If you have work in progress, you can commit your metadata changes into Git by means of a Git snapshot commit or  on a user story before refreshing the sandbox. Once the sandbox has been refreshed, you can use a Git MetaData deployment step to deploy the work in progress to the sandbox you just refreshed. This is a great way of ensuring no work in progress is lost.
  2. Rollback: When you detect a critical issue in a component in UAT or production, you can deploy a previous version of the component from a Git commit prior to when the issue was introduced in that component.


How did we do?