The version history keeps snapshots of your components. You can go back to an earlier state at any time, and publish a specific version.

In a component: Menu › Version history. From your files: right-click › Version history.
Click Restore next to a version: the component goes back to that state for everyone. Restoring itself creates a version, marked Restored from…: so you can always go back.
Delete removes a version from the history.
A version used by a published domain or widget must not be deleted: change the published version first.
What your visitors see is never your working copy, but a tagged version. So you can edit a component in peace, then publish your changes by creating a new version and assigning it to the domain or widget.