Skip to main content

Chapter 5 - Using an Existing Project

Repository

  1. Go to Bitbucket
  2. Go the repository for the project.
  3. At the top right of "Source", click Clone, then "Clone in VS Code"

    image-1743091507802.png

  4. Allow VSCode to open the link and install the extension if you are requested to do so. Also trust the publisher "Atlassian".
    1. If this is the first time, click on "Login to JIRA", follow the steps (including "back to vs code"), then also login to Bitbucket using the same screen.
  5. If during the Clone, Git requests a login, you might need an App Password. You can create one by going to the cog on the top right, going to Personal Bitbucket Settings, and App passwords.
  6. VScode will ask what to do - select "clone a new copy", and store it somewhere on your computer.image-1743091990513.png
  7. Log in to the Org that you will be working against. Presumably a scratch org, but if you're still using persistent Orgs, this means login to Production, and Dev orgs as needed, using 
  8. Ensure your workspace has Source Source Tracking, Atlassian, and Salesforce icons.

Salesforce

  1.  Go to your Production, then navigate to Setup > Dev Hub. ensure Enable Dev Hub and Enable Source Tracking in Developer and Developer Pro Sandboxes are both checked.

These settings allow both the CLI and Change Sets to function with Source Tracking.
This fully replaces the usual "compare the source and the target organizations

VSCode

  1. Open VSCode and open your Repository Folder using VSCode.
  2. If necessary, run sf org login --alias MyOrg with MyOrg being the org type (examples: Client-Prod, Client-Dev, Client-ScratchFeatureName)
  3. Start working in Salesforce, then go the Terminal and run sf project retrieve start --target-org MyOrg --ignore-conflicts --wait 20 where MyOrg is the organization you have logged in to which contains what you want. This assumes Source tracking is on.

This works best if you are the only one working in an Org. If you are not, you might want to start using Scratch orgs. Otherwise, you will see all the changes done by everyone.

  1. Go the Terminal and run sf project deploy start --target-org MyOrg --ignore-conflicts --wait 20 where MyOrg is the organization you have logged in to which must receive what you got. This assumes Source tracking is on. If Source Tracking is not on, or you want to do a full send, you can run sf project deploy start --target-org MyOrg --source-dir force-app --ignore-conflicts --wait 20
  2. Go to Source tab in VSCode, then add a commit message, Stage the changes required, and Commit.
  3. Push your changes (the cloud with an upwards arrow - name may change based on context) 

    image-1747667439880.png