9

Some times when I try to undo changes in Android Studio I get this:

Can't Undo

Following files affected by this action have already been changed.

That's nice but I don't care about the files affected. I only care about the current file. I will deal with those files later. Is there a way to force Android Studio to undo my textual changes in the current file and worry less about what's in other files? This is one of those situations when devs think they know better than the user. Makes me scared of using that undo button tbh.

1

1 Answer 1

25

The reason for this is

  • You have first done some action(A) which has affected some set of files including some file called F.
  • Then you have done some changes which has affected another set of files which including some files on previous set but not F.
  • Now you go to file F & try to undo. The action(last) on the top of the action stack for F is A. But when you request it to revert back, it has to revert back with all the other files because you are reverting the action not just text. But since some set of other files has over changed with your later actions, your request cannot bypass them. So you are getting message.

Can't Undo

Following files affected by this action have already been changed.

So you want only to revert your changes locally to F(or some folder). For that purpose you have a tool called Local History.

  • You can go to your file and then VCS -> Local History -> Show History. Or Right click your file or folder -> Local History -> Show History.
  • You can see your multiple revision histories and restore anyone you want. :))
Sign up to request clarification or add additional context in comments.

5 Comments

This works. BUT it would be really nice to have an option to limit undo/redo to the textfile that I am working on. And not have to jump through VCS menus to change things. Sometimes, I just want to undo to see what I just removed temporarily. It would be nice if the system was set up like other editors do.
@TatiOverflow I don't really understand why you need to change the limit by file. Because if you give a higher value for the limit, it would solve the lower limit requirement also. And you can undo step by step and bounce back to the previous state also. I don't exactly understand what about options you want it to have? :))
Regular editors. Any other editor. You are able to undo the changes you've just done to a text file. Even if they've affected other files, It's fine. you go to other affected files and fix whatever errors there are. It's just annoying. Trying to undo changes you just done a few seconds ago, and be told that you can't because this and that. It's just strange.
@TatiOverflow i understood your point. you can put your suggestion here youtrack.jetbrains.com/issues/IDEA if you are interested. anyhow I have a problem that, if the user wants to revert all set of changes, how it can be done with other editors?
I get that issue every time I do any change in the main activity class because apparently any change in there magically internally affects other files somehow.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.