Skip to content

Instantly share code, notes, and snippets.

@mhamzas
Created November 9, 2020 10:40
Show Gist options
  • Select an option

  • Save mhamzas/69f4e8349aa83d2fb7d50edf2ce1d9f3 to your computer and use it in GitHub Desktop.

Select an option

Save mhamzas/69f4e8349aa83d2fb7d50edf2ce1d9f3 to your computer and use it in GitHub Desktop.
This Batch file will get metadata from your Salesforce ORG and push it to GIT
@ECHO OFF
:: This batch file fetches metadata from your Salesforce ORG and push it to GIT.
:: Pre-Requsitie : Install : Node & https://www.npmjs.com/package/cs-jsforce-metadata-tools
:: npm install jsforce-metadata-tools -g
TITLE Salesforce Metadata to GIT
ECHO Welcome ! This Batch file will get metadata from your Salesforce ORG and push it to GIT
ECHO ============================
ECHO AUTHOR : M Hamza Siddiqui
ECHO WEBSITE : www.mhamzas.com
ECHO CONTACT : contact@mhamzas.com
ECHO ============================
ECHO CURRENT DATE : %date%
::PAUSE
::SET directory = <directory-where-you-have-package.xml> i.e. c:/xyz/abc/
::ECHO Getting into the directory %directory%
::cd %directory%
ECHO Retrieving Metadata
::forcecmd retrieve
jsforce-retrieve -u <username> -p <password+securitytoken> -D <directory-where-you-have-package.xml> -l https://test.salesforce.com --verbose --pollTimeout 120000000
::ECHO Adding GIT Repo as ORIGIN
::git init
::git remote add origin https://<username>:<password>@<gitlab-url.git>
::)
ECHO adding all the files
git add .
ECHO Assigning label to current changes
git commit -m "%date% Changes" --quiet
ECHO Pushing METADATA to GIT Repository
git push -f -u origin master
ECHO DONE!
PAUSE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment