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:
sfdx force:source:statusto determine what metadata I have changed remotely.
- then use
sfdx force:source:retrieve -m SomeMetadataType:MetadataNameto 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?