[urgent]Asking about restore local repo - sourceTree
Asked by Duc Nguyen:

Hi,

I'm suddenly delete the local repo that contain all of my code. Now all of my code is deleted, I do not know where the delete file go or any method that can help me to restore all the code.

Looking forward for all of your answer, it may save my life.

Thanks alot


Answers:
author: Seth
body: Is your repo pushed anywhere, or has it been cloned by someone else? If so, you should be able to re-clone it from that location.

Did you delete the parent folder that holds your repository, or just all of it's contents? Navigate as close to where the project was as you can in Windows Explorer/Finder, and make sure your OS is set to show hidden folders. If there is a .git folder, then you should still have your repository, and you've just deleted your working copy.

If the .git folder is NOT there, then you'll need to look for a generic method of recovering deleted files (maybe your OS backs up some files automatically? There are also utilities to recover deleted files that work if the data hasn't been overwritten.

comments: author: ChaudhryAbdullah
body: Seth foss bro , i have the exact same problem .i am very much new to this source tree , what i did was that i created a repo without naming it and gave the path of My desktop , then i checked the box (unstaged files) , and i did pressed the commit button , and then i deleted the repo and (it said while deleting that files would be removed from disk , i checked that option ), after that all the files and folders of mine which were present at desktop vanished and now there's only folder remaining which you have mentioned is ".git" ,and it is of 8.5GB , and it contains objects .now sir can please tell me all the steps how to recover my files back in my desktop area as they were like before..i would be very grateful thankue


author: ChaudhryAbdullah
body: @Seth


author: ChaudhryAbdullah
body: and i did not also do any remote,push,pull,clone operations


author: Duc Nguyen
body: Hi, I'm not sure which IDE you are using but for my situation I using Pycharm for Python development, the way that I gather back my code is that I come to to the IDE ( Pycharm in this case) choose VCS then it was a local history tab where you can check the auto save create by the IDE and then you can choose to load from the particular auto save. If you are not using Pycharm I suggest that you go to Google and search how to to restore history with (Your IDE name).


author: Seth
body: @ChaudhryAbdullah You should always have a repo inside a dedicate folder.With SourceTree, open the Clone/Add Repo dialog, and choose the "Add Working Copy" tab. Put your desktop in the path. You should be able to checkout whatever branch you had committed to. Let me know if that works.


author: ChaudhryAbdullah
body: @seth foss itrien very much everything but no avail , can you please give me your skype id , can you please help me with my problem by using sharing screens options in Skype?


author: ChaudhryAbdullah
body: @Seth Foss


author: Seth
body: If you can't load the repository, there's nothing I'm going to be able to do.


author: ChaudhryAbdullah
body: how to load the repo ?