Try clicking on your scratch org name( you have greyed it out) in the bottom bar and then selecting it as default. Or you can run sfdx force:config:set defaultusername=Org_Alias
command from CLI or any script you are using. I face this issue everytime i create a new scratch org(4-5 times per day) and I always have to do this step. I believe it's an issue with VS code/SF cli which is unable to recognize the org as default.
This appears to be a bug. Running sfdx force:source:status -a
(or "SFDX: View All Changes" in the VS Code plugin) shows you remote and local changes, but in this case reports remote changes even when the files are identical. You can verify this using the Source Diff plugin (currently in beta).
The quick and easy workaround is to use the -f "force" option in your push command (sfdx force:source:push -f
, or look for "...Override Conflicts" in the VS Code command palette). But be aware you should also exercise caution when collaborating with other developers, so as not to override someone else's work.
Unfortunately this also makes the "push on save" feature redundant, but there is a workaround for that too. Using Multi-Command for VS Code you can configure a single keybinding to save and auto-push with the --force option.
1 - Install the Multi-Command for VS Code plugin using VS Code.
2 - Add the following to your settings.json
"multiCommand.commands": [
{
"command": "multiCommand.saveAndForcePush",
"sequence": [
"workbench.action.files.save",
"sfdx.force.source.push.force"
]
}
]
3 - Add the keybinding to your keybindings.json file (it's in the same directory as settings.json)
{
"key": "Ctrl+Shift+s",
"command": "multiCommand.saveAndForcePush",
"when": "editorTextFocus"
}
This sets Ctrl+Shift+s
as a hotkey to first save the file locally, then use SFDX force push. Change the hotkey as required (VS Code Keybinding docs for more details).
Best Answer
[ UPDATE! ] They have supposedly enabled this with a org definition file feature: https://releasenotes.docs.salesforce.com/en-us/summer18/release-notes/rn_sfdx_scratch_orgs.htm
Disclaimer: I have not been able to use this feature when I try to turn this on I get the error: ERROR: StateAndCountryPicklist is not a valid Features value.
[ Original Post ] I've ran into this issue as well.
I was able to configure which Countries and State to show under Step 1: Configure state and country/territory picklists.
Converted and Enabled the picklist and then... When I did a sfdx force:source:pull it pulled the configured Active/Visible country options under Address.settings-meta.xml
I tried spinning up a new scratchOrg and it pushed those configuration but I still have to manually re-convert and enable picklists again.
I know it's not the answer you're looking for but just wanted to share my progress.