+ 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


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.

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


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
        status: unchanged
        status: changed
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.