Dealing with Slow Salesforce Deployments? Try Resetting Your Source Tracking

If you’ve been working in a Salesforce DX project for a while, you might notice that running sf project deploy start begins to feel sluggish. Sometimes, it stays stuck at “Polling for status” or “Initializing” for minutes before any actual progress occurs.

Recently, I encountered this exact issue. After trying a few different angles, the solution turned out to be simpler than expected: Resetting the source tracking.

The Problem: The “Ghost” in the Source Tracking

Salesforce DX uses local files (stored in the .sf or .sfdx hidden folders) to keep track of what has changed between your local environment and your scratch org or sandbox. This is what allows the CLI to perform “delta” deployments—only sending what has actually changed.

Over time, especially after large merges, switching branches, or interrupted deployments, these tracking files can become bloated or corrupted. The CLI spends an enormous amount of time trying to reconcile the differences, leading to the “long hang” you might be experiencing.

The Fix: A Fresh Start

If your deployment is taking an unusually long time, you can force the CLI to stop “thinking” and just start fresh by following these steps:

1. Reset the Tracking

Run the following command in your terminal: sf project reset tracking

What this does: This clears the local source tracking files. It tells the CLI, “Forget everything you think you know about what is or isn’t in sync.” It does not delete your code; it only deletes the metadata about your code.

2. Force the Deployment

Once the tracking is reset, run your deployment again pointing to your source directory: sf project deploy start --source-dir "force-app/main/default"

Because you reset the tracking, the CLI will now treat this as a clean deployment of those files, often bypassing the logic loops that were causing the previous delays.

When should you use this?

While resetting tracking is a powerful “turn it off and back on again” fix, use it specifically when:

  • Your deployment hangs on the initial “Analyzing” or “Metadata” phase.
  • You’ve just performed a massive git pull or branch merge.
  • The CLI is reporting conflicts that you know don’t actually exist.

Conclusion

Efficiency in Salesforce development is all about keeping your local environment lean. If the CLI is acting up, don’t just wait for the loading bar—reset your tracking and get back to coding.

Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply