How to recover or prevent from accidental UNDO/REDO operations on Visual Studio 2010

dosuken123 picture dosuken123 · Sep 6, 2016 · Viewed 8.3k times · Source

Case 1 (Overwritten undo/redo history)

  1. You are editing source codes on "Program.cs". After a dedicated hour, You've done with 100 lines and typed "Ctrl+S"(Save).
  2. To take a break, you left your desk without closing the "Program.cs" and Visual Studio. While you're leaving, your dog came to your desk and typed sequently
    "Ctrl+Z"(Undo) > "Ctrl+Z"(Undo) > ... (Until the original codes appered) > "a"(Type text).
  3. You came back from a break but it's too late. You're pressing "Ctrl+Z"(Undo) or "Ctrl+Shift+Z"(Redo) to recover your 100 lines, but all you can get is the original codes or "a".

Case 2 (Discard undo/redo history)

  1. You are editing source codes on "Program.cs". After a dedicated hour, You've done with 100 lines and typed "Ctrl+S"(Save).
  2. To take a break, you left your desk without closing the "Program.cs" and Visual Studio. While you're leaving, your dog came to your desk and typed sequently
    "Ctrl+A"(All) > "a"(Type text) > "Ctrl+S"(Save) > "Ctrl+F4"(Close the src).
  3. You came back from a break but it's too late. You're pressing "Ctrl+Z"(Undo) or "Ctrl+Shift+Z"(Redo) to recover your 100 lines, but all you can get is "a".

What i want to say through the above cases is "It's quite easy to lose the 100 lines."
I knew those possibilities and believed that i'll never catch of them, but the Second Case just happened 30 minutes ago by own mistake.

I want to know whether any solutions exist except SVN/GIT commit and rollback features.
Unfortunately, "Undo/Redo Last Global Action" didn't work for me.

Thank you for your help.

Answer

Terje Sandstrøm picture Terje Sandstrøm · Sep 6, 2016

You asked for VS2010, but tagged this also for VS2012, and for VS2012 and onwards you have the Microsoft Devlabs AutoHistory extension which tracks local history. The extension is here: https://visualstudiogallery.msdn.microsoft.com/dfcb2438-180c-4f8a-983b-62d89e141fe3 , a blog on it is here: https://blogs.msdn.microsoft.com/visualstudio/2014/01/23/auto-history-extension-in-visual-studio-2013/

Example screenshot, the diff produced for a file where I added a Subtract method, saved it, then my dog came around and wiped it off and wrote "bbbbb" instead. enter image description here