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?
force:source:retrieve
because it has a-m
flag allow a specific piece of metadata to be pulled back. Whereasforce: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.