简体   繁体   English

从 Eclipse 中恢复已删除的 Git 存储库

[英]Recover Deleted Git Repository from Eclipse

I am stuck here and in extreme need to expert advise我被困在这里,非常需要专家建议

I have created an Android project in Eclipse and was in the process of creating a git repository for it using EGit.我已经在 Eclipse 中创建了一个 Android 项目,并且正在使用 EGit 为它创建一个 git 存储库。

I have gone through the normal process of creating a repo in Eclipse: right-click project -> Team -> Share Project我已经经历了在 Eclipse 中创建 repo 的正常过程:右键单击项目 -> 团队 -> 共享项目

I gave the repo a name and hit continue to create it.我给 repo 起了一个名字,然后点击继续创建它。

The progress bar started flashing but in the middle i got a problem creating the repo.进度条开始闪烁,但在中间我在创建 repo 时遇到了问题。 I do not remember what the issue was but i decided to delete that repo and start from scratch.我不记得问题是什么,但我决定删除该存储库并从头开始。

So i went to Git Repositories in Eclipse and hit delete repo.所以我去了 Eclipse 中的 Git 存储库并点击了删除存储库。 I checked the box that says delete existing files in the repo.我选中了删除 repo 中现有文件的框。 And unfortunately, the whole Android project was deleted from Eclipse :(不幸的是,整个 Android 项目都从 Eclipse 中删除了:(

i was not aware that by creating a repo the original files will be copied over to the repo folder and removed from the workspace :'(我不知道通过创建存储库,原始文件将被复制到存储库文件夹并从工作区中删除:'(

Does any one know an approach to recover that deleted repo/project?有没有人知道一种恢复已删除的回购/项目的方法?

Many thanks非常感谢

In eclipse there is an option for projects.在 Eclipse 中有一个项目选项。 Right of project and see : "Recover from local history".项目的权利,请参阅:“从当地历史中恢复”。 This should help you这应该可以帮助你

I had the same problem, deleted project so there is no "Recover from local history" button to click, and no local windows history, but you can do a manual recover from history.我遇到了同样的问题,删除了项目,因此没有可单击的“从本地历史记录恢复”按钮,也没有本地 Windows 历史记录,但您可以从历史记录中手动恢复。 I tried this solution in Eclipse Oxygen/Windows 10, First of all, eclipse store history file at here,我在 Eclipse Oxygen/Windows 10 中尝试了这个解决方案,首先,eclipse store history file at here,

(workspace)/.metadata/.plugins/org.eclipse.core.resources/.history/

and there is a lot of file with long name like this '006de3225c86001811b7ff2e93138537', that's the history file eclipse using to recover, you can search the text inside those file for the package name of the deleted project, then you can pick the latest one, copy past it to the new project location, renaming them to the correct file name.并且有很多像'006de3225c86001811b7ff2e93138537'这样的长文件,这是eclipse用来恢复的历史文件,你可以在这些文件中的文本中搜索被删除项目的包名,然后你可以选择最新的,将其复制到新项目位置,将它们重命名为正确的文件名。 This approach is complex, but works for me.这种方法很复杂,但对我有用。

If you deleted your git repository permanently and it is showing that there is no project or file on eclipse window .如果您永久删除了 git 存储库,并且显示 eclipse 窗口上没有项目或文件。 Then go to your current workspace of eclipse and search these file name there, you got all of your file there and you can see every folder and files of that project.然后转到您当前的 eclipse 工作区并在那里搜索这些文件名,您在那里获得了所有文件,您可以看到该项目的每个文件夹和文件。 The workspace of eclipse is in C:/User/name/workspace/current_workspace_name/project_name eclipse 的工作区在 C:/User/name/workspace/current_workspace_name/project_name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM