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.
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. :))
Related
In Android Studio/Intellij, is there a way to copy a chunk of code from one file to another without loosing the history.
For example: Highlighting a word --> right click --> Refactor --> Copy: permits to copy a class to another location while keeping the history of the whole class.
Is there a way to do the same thing just for a piece of code using the IDE?
IntelliJ IDEA doesn't control the VCS history. The history is only managed by the git and it doesn't support this feature.
For a mistake i've overwritten my two project that has same names from android studio and i've dismissed that action today i've tryed to open the main project and i've found no Java classes in it and just the layout's files.
While in the second project to which i was overwritting there is a huge confusion of files and trying to recover the project version by using history of Android Studio even those files has disappeared.
Is it possible in anyway to recover the whole project?
Ps: all that remain from that project is a generated apk.
I have some solutions that may work.
Candidates are:
Search for $AppData$ folders
Search for registries
(Hardest) you may have to preserve the disk state and carve the files yourself..
Cheers, and hope it helped..!
To use the third method(file carving), you may not cause many file operations occur!!(The system may overwrite the previous data)
Hopefully you used source control such as git or svn and it is a simple matter of reverting to the last commit you made, however that is done in your chosen source control. If you don't use source control, perhaps this will serve as a lesson to do so in the future.
I've not used Android Studio, but as a JetBrains product like IntelliJ, it will have a local history record of changes. But that would only record very recent changes.
If that doesn't work, you may have to find out if your chosen operating system backed up the files in a restore point etc.
If you have turned on the file history, you can use that to go to a previous version of the folder. Can also use system restore to go back to a previous date. Can also use third party softwares such as Recuva to get deleted files back.
Make sure to keep a copy of current state somewhere before trying these out.
After updating I am getting this notification.
I understand your problem follow these steps to recover your local deleted file and code:
Go to toolbar: VCS->Git->UnStash Changes
From UnStash Changes pick recent Uncommitted changes
Click to view button
You will get a list of all files which get affected
Now you can merge manually those files which are affected and one thing you have to do manually add deleted files again.
So, I want to rename a file in android studio (layout/resource files, etc...), but I want to do it safely. Basically, I want to rename without refactoring. I will take care of errors that come afterwards, but I don't want Android Studio to wreck havoc on some files that might not even have relations with the current file.
Basically, I want control on the renaming. A simple file rename. Is there a way to do it without having to go to Windows Explorer?
There's two options and both inside the Refactor menu. The Refactor> Rename option is exactly what you don't want the other one Refactor> Rename File option is just what you want. Also when using Refactor> Rename it will show you the Refactoring Preview. There you see and select what is going to be affected by this change. To see options just right click
A very common thing that I tend to do is when I need to update a graphic or something in the drawable-nodpi folder, or any other folder for that matter, Android Studio doesn't detect the change so of course when I try to "PUSH" to GitHub it doesn't actually push and just tosses me the "No Changes Detected" message.
Is there a way to push anyways? Just to force a commit on specific files that I want to push because I know for a FACT there was a change and I need it submitted?
Lately I been having to delete it first from within Android Studio, then save the file, then add it to GIT then try a commit, but even this works only 70% of the time and is very annoying.
Perfect Example.... I have a splashimage.png in the drawable folder, I am in Photoshop and I change something then do an override to the splashimage.png with my change, but of course Android Studio doesn't see this as a change so I can't Commit this file to Git or anything.
Are you using external editors like photoshop when editing files? If so, press refresh in Android Studio to make it detect changes in file system. Then it says something has changed and suggest you to commit. Of course you can use command line to add changes anyway and commit without even using Android Studio.
Apparently the item I was looking for was the Synchronize. I just go to the file and Right Click > Synchronize and it then does a check against the last one manually and see's if it was different. Kind of a Refresh like Kuitsi had stated, but its called Synchronize. Also some reason I can't get it to work by just clicking Synchronize next to the SAVE icon at the top under File menu. Not sure why.
Whats your git status after you copy the file? Do you commit the changes, before pushing?
Have the same problem. Resolved.
The multi-root project used to work just fine for years, detecting changes in sub gits, properly pushing/pulling per sub, but not anymore. After some playing with a broken merge, it has stopped working. And that's not a local git repo issue. Cloned it from scratch - same issue. Changes (doesn't matter internal or external) are not detected by the Studio VCS facility, though git from console shows changes, View/Recent Changes shows them, Local Changes tab doesn't show any (single Default changelist).
It looks like something has happened with the VCS roots detection or related settings. Fixed with Preferences/version Control adding missing roots manually. I wish there is an option to rescan a folder or to delete some settings file and have the studio detecting these roots again.