Long running workspaces that are automatically shut down will auto-commit your work before shutting down. No additional settings are required.
That being said there are a couple of edge cases worth considering:
(1) Linked git repos will not be pushed/committed unless you’ve specifically set that up
(2) Only what’s been written to disk will be saved (i.e. you will lose your objects in memory and your files not yet saved to disk). So, for example, you must save a workspace you're editing within Jupyter in order for it to be committed when the workspace shuts down.