Stopping undo past file open?

Hi all,

I'm hoping this is just a setting I've missed and someone can point me at it: is there a way to make IDEA's undo buffer NOT survive a file open/close?

What I mean is this... if I'm editing a file, and I save and close it and then open it again, hitting control-z to undo will start undoing things that happened BEFORE that save and close.  That to me is very annoying because I use save/close/reload as a sort of "marker" during my work... so if I have a large task that decomposes into a couple of smaller ones I'll do that after each smaller one once I get it working so I know I can always undo back to that "good" state without having to check in partial code to source control.  But the way IDEA works here breaks that paradigm, the undo buffer needs to be cleared when I open a file basically or I can't work my usual way, which is annoying.

So, hopefully it's just a setting I missed like I said, but I've been through them and haven't seen anything.  Anyone help out?


Comment actions Permalink

I do not believe such a setting exists. However, IDEA's local history is the feature that is aimed at providing the functionality you are describing (marker points and a way to incrementally write code without a version control commit). The local history automatically applies labels during specific events. You can also apply labels yourself. That will server as the marker you are currently using a save for. So you can easily rollback to a label. And you get diff with merge capability so you can be selective as to what you rollback. Using undo, you can only undo in the same order as the changes were made. If you want to undo the first thing you did, but keep the last four, you cannot do that with undo. You can with local history.

In the help guide, see the following for more information:

  • IntelliJ IDEA > Basic Concepts > Version Control with IntelliJ IDEA > Local History
  • IntelliJ IDEA > IntelliJ IDEA Usage Guidelines > Using Local History
Comment actions Permalink

Thanks Mark, I'll look into that, it does sound like it'd do the trick... I'll just have to get out of the habit of control-z'ing :)  I'll leave this as unanswered for the time being just in case there does happen to be such a setting (maybe its hidden?) or maybe a plugin that'll do it... but assuming you're right and there's no such setting you've given me a good answer, I appreciate it!


Please sign in to leave a comment.