Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio Can't Undo

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.

like image 870
TatiOverflow Avatar asked Dec 11 '16 20:12

TatiOverflow


Video Answer


1 Answers

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. :))
like image 95
Supun Wijerathne Avatar answered Sep 26 '22 19:09

Supun Wijerathne