code-editor

Is there a code editor that makes it possible to revert to a previous version?

I am coding in javascript a very big file and I keep wanting to go back to a previous version because of bugs I have created in the new version. Are there any code editors that allow you to revert to a previous version of the code? ...