问题描述
我想在eclipse中创建一个新的git存储库,而当我删除旧的git存储库时,不幸的是整个项目已从工作空间中删除!
I wanted to make a new git repository in eclipse and when I was deleting the old one, unluckily the whole project has been deletet from the workspace!
有任何恢复项目的方法吗?
Is there any way to restore the project?
感谢您的回答!
推荐答案
如果您的工作有另一个存储库(例如中央git服务器,另一个开发人员,另一台计算机或类似的东西),则可以从该存储库克隆回来:
If you have another repository with your work (like a central git server,another developer, another computer or something like that) you can just clone your repository back from that:
File -> Import -> Projects from Git -> URI ->
Type in your server/the other developers repo and complete the wizard.
这就是失去工作的原因:
And here is the reason why you lost your work:
为了使git正常工作,egit将所有项目文件移动到存储库中(这只是一个特殊目录)。因此,如果删除存储库,则还将删除其中的所有文件,其中包含整个项目。
In order to make git work, egit moves all the project files into the repository (which is only a special directory). Therefore, if you delete the repository, you also delete all the files in it, containing your whole project.
对于未来:
要移动存储库,只需使用常规文件浏览器将其移动到另一个位置即可。之后,通过从存储库视图中删除存储库(不要删除它)来告诉Eclipse:
To move your repository, just move it to another position using a normal file explorer. After that, tell eclipse about that by removing the repository from the repositories view (NOT deleting it):
In the Repositories View: Right-click on the repository ->
Remove from Repositories View
然后将存储库添加到新位置:
Then add the repository in its new location:
In the Repositories View: Upper right corner:
Add existing Git Repository to this view
这篇关于恢复已删除的Eclipse项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!