function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jansi AJansi A 

How to use CLI(Command Line Interface) to commit and deploy the code to Git Repository and Salesforce directly

Hi,

I have used Eclipce IDE, to create Force.com project by checking out all my Dev SF POD apex classes, aura components and static Resources. From which I have checkIn the code to Git Repository. Also able to deploy the code from Eclipce to Salesforce.

I have found a online below tool to deploy code directly from Git to Salesforce. Not sure how secure is this.
https://githubsfdeploy.herokuapp.com/

So, can we deploy the code from Git to Salesforce directly using CLI?


Regards
Jansi



Regards
Jansi
Mukesh Kumar 107Mukesh Kumar 107
If you are able to write the script to retrieve the code from the Git, which you could, then the rest of the action could be completed by Force.com CLI. In other words, CLI needs a deployment folder containing package.xml and directory of resources to be deployed. Run the following command in your script to export the metadata 
 
kumamuk01@MACHINE C:\Users\kumamuk01\dev\salesforce_ant_39.0\prod\archive
> force import -directory=test_deploy_workbench -c -r -v
Not done yet: Queued  Will check again in five seconds.
Not done yet: InProgress  Will check again in five seconds.

Failures - 0

Successes - 3
Sales_Target__c.x_test__c
        status: unchanged
        id=00Nc0000001dQuCEAU
Acknowledgement_Process_v3-10
        status: changed
        id=301c0000000ESLZAA4
Imported from C:\Users\kumamuk01\dev\salesforce_ant_39.0\prod\archive\test_deploy_workbench

kumamuk01@MACHINE C:\Users\kumamuk01\dev\salesforce_ant_39.0\prod\archive

You could run varied CLI command for import.