Skip to content

How to refresh your sandbox from a branch

Bring the current metadata of an upstream branch (for example develop) down into your developer sandbox, so you continue working from the latest shared state instead of a stale org. It is a plain deploy — a branch is the source, your org is the target.

Full refresh (default, safe)

Check out the branch you want to pull from and deploy it to your sandbox:

git checkout develop
git pull
npm run deploy -- --target-org my-sandbox --no-prompt

Faster: deploy only what the branch gained

If you branched off the upstream branch, deploy just the difference since your branching point. While still on your feature branch, print the merge-base:

git merge-base HEAD origin/develop

Copy the SHA it prints, then switch to develop, pull, and deploy using that SHA as --delta-from:

git checkout develop
git pull
npm run deploy -- --target-org my-sandbox --delta --delta-from <merge-base-sha> --no-prompt

--delta turns the delta on; --delta-from sets its base so the package holds exactly the components develop gained since you branched, and --delta-to defaults to HEAD. Accepted forms and defaults: deploy flags.

The delta comes from git, not from your org

Metadata edited directly in the sandbox is invisible to the diff and left as-is — when unsure whether your sandbox drifted, use the full refresh. See refreshing a sandbox is a deploy, not a sync.

Watch the per-environment replacements

A deploy also runs any value replacements declared in sfdx-project.json — this is a Salesforce CLI source-behavior feature, not part of the DIA workaround chain, so --skip-workarounds has no effect on it.