Learn how to streamline Salesforce development using Git, Visual Studio Code, and Salesforce CLI. Discover practical commands for branching, merging, cherry-picking, deploying, and retrieving metadata with ease.

Working as a Salesforce developer often requires moving quickly between Git version control, Visual Studio Code, and Salesforce CLI (sfdx/sf). Managing branches, integrating code changes, and deploying metadata to different orgs are everyday tasks. In this article, we’ll go through some essential commands you can use to improve your workflow and ensure smoother collaboration with your team.

🔹 Git Commands for Branching and Code Management

  1. Checkout a feature branch
git checkout feature/1577
  1. Merge another branch into your current one
git merge release/1574
  1. Cherry-pick a specific commit by ID
git cherry-pick de9f2c2
  1. Update local references from remote
git fetch
  1. Push your changes to the remote branch
git push
  1. Pull the latest updates from the remote branch
git pull

These commands help keep your repository in sync and ensure that your Salesforce project stays aligned with your team’s changes.


🔹 Salesforce CLI Deploy and Retrieve Commands

Salesforce CLI makes it easy to deploy and retrieve metadata directly from VS Code.

  • Deploy using a manifest file
sf project deploy start --manifest manifest/package.xml --target-org nomeSandbox
  • Retrieve using a manifest file
sf project retrieve start --manifest manifest/package.xml --target-org uat
  • Deploy a specific metadata file (example: custom field)
sf project deploy start --source-dir .\force-app\main\default\objects\SBQQ__Quote__c\SBQQ__Status__c.field-meta.xml --target-org nomeSandbox
  • Retrieve a specific metadata file
sf project retrieve start --source-dir .\force-app\main\default\objects\SBQQ__Quote__c\SBQQ__Status__c.field-meta.xml --target-org nomeSandbox

✅ Final Thoughts

By combining Git for version control and Salesforce CLI inside Visual Studio Code, you can build a faster, safer, and more reliable development workflow. Whether you’re merging branches, cherry-picking commits, or deploying specific metadata, these commands are the foundation of a successful Salesforce DevOps pipeline.