4

I'm working on a Lightning App site where I'm developing locally using Visual Studio Code, and then deploying my changes to my default org (I'm using the Salesforce CLI Integration extension).

Is there a way in Visual Studio Code to show which files I've made updates to but have not deployed to my default org?

I noticed that a change I made was not visible on the website, and then I realized "oh!" I never deployed the change. And then I started getting suspicious and wondering what other changes have I not deployed.

2 Answers 2

3

You can use diff against the org commands for a UI that shows changes from your org (in both directions!).

You can also see your current status from a terminal command:

sfdx force:source:status

Or you can deploy any changes that are detected in your workspace:

sfdx force:source:push

You can also go in to your Settings (File > Preferences > Settings > Extensions > Salesforce Feature Previews > Salesforcedx-vscode-core > Push or Deploy On Save) to make sure that every file you save automatically pushes.

5
  • 2
    also worth mentioning diff against the org as a useful sanity check Commented Aug 26, 2021 at 19:51
  • @KrisGoncalves historically, that command has never worked for me, so I forgot about it. I'll edit that in.
    – sfdcfox
    Commented Aug 26, 2021 at 19:52
  • "...to make sure that every file you save automatically pushes." That scares me.
    – Moonpie
    Commented Aug 26, 2021 at 20:02
  • 2
    @Moonpie To each their own; I personally prefer to know that what is on my screen is what's in the org (but I'm also a "master" developer with lots of confidence and a bit of hubris), but you can at least take comfort that if there's any compilation errors on push, nothing will be modified on the server until everything is fixed; your server should never be in a wholly inoperable state.
    – sfdcfox
    Commented Aug 26, 2021 at 20:04
  • 1
    Touché! I am closer to a "junior" developer with lots of confidence and lots of hubris.
    – Moonpie
    Commented Aug 26, 2021 at 20:07
3
  • Use sfdx force:source:push rather than ...:deploy
  • Use sfdx force:source:pull rather than ...:retrieve

Then you can use sfdx force:source:status to see changes.

  • If you are using a Scratch Org, you should just be able to use the above commands.
  • If you are using a Sandbox, in your Dev Hub org you will need to go to Setup >> Dev Hub and check Enable Source Tracking in order to be able to use the above commands.

To start off with a "clean slate" so to speak, when you first set this up in your Sandbox, and you have already done some work like you have, you can run

  • sfdx force:source:tracking:clear to clear local tracking
  • sfdx force:source:tracking:reset to clear both local and remote tracking

See: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_source_tracking.htm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .