Every time a template is changed, a previous version is kept, so you can review what changed and roll back if a change causes a problem.
Go to Settings > Advanced Settings > Template History.
Templates affect your whole site or every email, so having a history to fall back on means a mistaken edit is never permanent - you can always undo it.