我不小心在项目中覆盖了一个文件,但需要恢复到较早的版本。 Eclipse有没有将旧文件缓存在某个地方?
解决方案完成CurtainDog的答案:从 eclipse常见问题
每次在Eclipse中修改文件时,旧的内容的副本将保存在本地历史记录中。在任何时候,您可以将文件与历史记录中的任何旧版本进行比较或替换。 虽然这不是替代真正的代码存储库,但是当您更改或删除文件时,可以帮助您事故。 本地历史还有一个优点,它并不是真正设计的:当您的工作区遇到灾难性问题或遇到损坏工作区文件的磁盘错误时,历史记录还可以帮助您。 作为最后的手段,您可以手动浏览本地历史文件夹以查找丢失的文件的副本,这有点像使用Google的缓存来浏览不再存在的网页。
每个文件修订版都存储在历史文件夹内的随机文件名的单独文件中。工作区内的历史文件夹的路径是
.metadata / .plugins / org。 eclipse.core.resources / .history /
您可以使用操作系统的搜索工具查找文件你在找
请注意,如果您需要将本地历史记录导入到新的工作区中,您将需要两者:
- .metadata / .plugins / org.eclipse.core.resources / .history
- .metadata / .plugins / org.eclipse.core.resources / .project
具有该新功能的本地历史记录工作区。
Can someone explain how Eclipse's local history works?
I accidentally overwrote a file in a project but need to revert to an earlier version. Is there a chance that Eclipse has the older file cached somewhere?
解决方案To complete CurtainDog's answer: from eclipse FAQ
Every time you modify a file in Eclipse, a copy of the old contents is kept in the local history. At any time, you can compare or replace a file with any older version from the history. Although this is no replacement for a real code repository, it can help you out when you change or delete a file by accident. Local history also has an advantage that it wasn’t really designed for: The history can also help you out when your workspace has a catastrophic problem or if you get disk errors that corrupt your workspace files. As a last resort, you can manually browse the local history folder to find copies of the files you lost, which is a bit like using Google’s cache to browse Web pages that no longer exist.
Each file revision is stored in a separate file with a random file name inside the history folder. The path of the history folder inside your workspace is
.metadata/.plugins/org.eclipse.core.resources/.history/
You can use your operating system’s search tool to locate the files you are looking for.
Note, if your need to import your local history into a new workspace, you will need both:
- .metadata/.plugins/org.eclipse.core.resources/.history
- .metadata/.plugins/org.eclipse.core.resources/.project
to have a functional local history in that new workspace.
更多推荐
Eclipse的本地历史...文件保存在哪里?
发布评论