androidgitandroid-studioversion-controlfile-recovery

How to recover local uncommited files that accidentally got deleted in Android Studio?


I faced a sudden issue, I have deleted some of my un revisioned files during commit to my android project but I found all of the modified and newly added files were missing from my commit (which I was going to make). I can not just remove or pull again the project from the origin because it will completely remove the VCS cache of the previous one. How do I get my files back?

I have also checked this questions and answers but this didn't solve my issue. So, I have found a solution otherwise with new Android Studio update.


Solution

  • If you had already imported the project from VCS but accidentally removed the .vcs file and lost your files while cleaning your project or unrevisioned files. Just go to
    Preferences -> Version Control (for mac) or Settings -> Version Control (for windows)
    and we will be seeing a directory with VCS status. By selecting and applying the changes, the project automatically syncs and is updated with your previous from. Find the attached image for reference.
    You can also just enable the VCS from your toolbar and sync the project.
    Thanks


    N:B: I couldn't find the VCS -> Local History initially because I was needed to enable the VCS first.



    enter image description here