1

To set up for development work, I create a scratch org and push in metadata stored in a github repo.

I find that after I have completed a piece of work (or part way through), I may have changed some metadata remotely (i.e. via the Salesforce UI), which I then want to pull into my local code base.

My process is:

  • run sfdx force:source:status to determine what metadata I have changed remotely.
  • then use sfdx force:source:retrieve -m SomeMetadataType:MetadataName to get that metadata from the org into my local source code.

However, once I have used the retrieve command, if I try to save again I am always prevented by a number of conflict messages. The only way I can resolve this is to either create a new scratch org, which takes a lot of time, or do a sfdx force:source:push -f to force push the metadata. Again this takes a lot of time.

Is there a way I can retrieve metadata from an org, but avoid these conflict errors and maintain the source tracking?

2
  • Use pull instead of retrieve. You are mixing the commands inappropriately. The retrieve is NOT updating tracking status and hence your conflicts.
    – Phil W
    Commented Dec 30, 2020 at 11:27
  • Hi Phil. Thanks for your comment. Yes, I should have said that I was specifically using force:source:retrieve because it has a -m flag allow a specific piece of metadata to be pulled back. Whereas force:source:pull doesn't have that option, so I get a large amount of other metadata that I then have to remove from my local code base before commiting.
    – lemming
    Commented Dec 30, 2020 at 11:47

1 Answer 1

2

You should use force:source:pull and force:source:push to ensure tracking status is maintained in both directions.

You must log in to answer this question.

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