Users of PyCharm may have discovered that long ago, but I had this revelation occur to me just today, and it saved me hours of work! So I just have to do a homage to it:
PyCharm keeps local history of files. It may be accessed by right clicking file tab or anywhere in the text of opened file. Select Local History and then Show History. A nice diff window opens with previous versoins. If reverting to older version is required, select it and click revert (purple rounded arrow icon). Either on top in the menu, or by right clicking on the chosen version in the menu and selecting the option.
PyCharm keeps local history of files. It may be accessed by right clicking file tab or anywhere in the text of opened file. Select Local History and then Show History. A nice diff window opens with previous versoins. If reverting to older version is required, select it and click revert (purple rounded arrow icon). Either on top in the menu, or by right clicking on the chosen version in the menu and selecting the option.