How to sync between SFDX Project and Scratch Org

by | Jan 2, 2019 | Lightning, SFDX | 0 comments

In my last post I demonstrated how to create an SFDX Project and how to create a scratch org from it. In this post, I am gonna demonstrate how to track your changes and sync them between your SFDX Project and your Scratch Org.

1. How to pull your changes from your Scratch Org to your SFDX Project:

  • Open your scratch org using sfdx:org:open -u <Org alias>
  • Make some changes to your org, like custom object, custom fields etc.
  • Time to pull the changes back into your SFDX Project.
  • Use the following command in the terminal. Make sure you are in the right project folder.

 

-f indicates that you would like to overwrite the SFDX Project changes in case of a conflict. There are options available which you can easily find out by typing sfdx force:source:pull –help and pressing enter. Check out the video for more details.

2. How to push your changes from your SFDX Project to your Scratch Org :

  • Open your scratch org using sfdx:org:open -u <Org alias>
  • Make some changes to your SFDX Project e.g. create Trigger, Apex Class etc.
  • Time to push the changes back to your scratch org.
  • Use the following command in the terminal. Make sure you are in the right project folder.

 

-f indicates that you would like to overwrite the Scratch Org changes in case of a conflict. There are options available which you can easily find out by typing sfdx force:source:push –help and pressing enter. Check out the video for more details.

Once all your changes are synced between your SFDX Project and Scratch Org, make sure you commit and push all these changes into your Git Repository (or any other repository) for safe keeping. That’s it guys! You are all set. Now you can easily track changes in your org without the need for an excel sheet. Isn’t that great? In my next post I will show you how to move these changes from your SFDX Project into a non-Scratch Org e.g. sandbox or Production. Also, how to convert existing changes in a non-Scratch Org into source and pull into an SFDX Project. Until then adios amigos!

 

Bishwambhar Sen
Bishwambhar Sen is an IT professional with over 10 years of industry experience. He is a Salesforce certified developer and admin. When he is not configuring and customising, he loves photography, traveling and blogging.
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

Share This