Can we restore an expired scratch org or extend the duration of its usability? I created a scratch org with 3 days of duration using:

sfdx force:org:create -f config/project-scratch-def.json -d 3

The scratch org will expire today, but I still need to use it. At the same time I haven't finished my work and pushed it to the git.

Does anyone have any idea?


Your scratch org is never the source of truth (the home of your current work) in SFDX. Just make sure your local copy is up to date with any changes you might have made in the user interface by doing sfdx force:source:pull.

Once your local copy is up to date, you can just sfdx force:org:create a new scratch org and sfdx force:source:push all of your work there to continue development. No need to worry about the expiring scratch org.

If you want to make Git commits along the way, you can always commit on a local branch and only later merge to your server branch and push. Pro Git is available for free and is a fantastic resource to really learn the ins and outs of Git flow.

  • 2
    Yes, but maybe some data was set up in the scratch org which you may not want to repeat in the new org, which could take some time. – Aequitas Jul 8 '18 at 23:20
  • 3
    If you're populating data in the scratch org that has a lifespan > 7 days, you should be using tree export commands or other scriptable data loads. It's not a good idea to try to treat scratch orgs as if they are anything other than 100% disposable. – David Reed Jul 8 '18 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.