Restore deleted file directly from Eclipse local history

廉价感情. 提交于 2019-12-07 14:39:33

问题


Some git mistakes happened and I lost a lot of changes for one file. I was using Eclipse as my IDE but the git mishap included deleting the project and re cloning the directory. So I can't do the restore from within Eclipse. I believe I have found the local history file that contains the code I want to restore but I'm not sure how to cat this file. It kinda looks like a json.

Anyone know how to restore or read the .metadata.plugins\org.eclipse.core.resources.history files?


回答1:


I was able to recover my code.
I went to prj/.metadata/.plugins/org.eclipse.core.resources/.history
Then did some bashing:

fgrep -r -c "[Some function name specific to that file]" * | grep -v ":0" | cut -d : -f 1 | xargs ls -l | grep "Jul 29"

So this is greping and counting the number of times some text specific to the code I'm missing shows up in the files, then removes the files where the count is 0, then removes the count from the end of the file name, then does ls to get details on the files, then optionally search for a specific day. Since I was working with clojure I noticed that there were files that either had a large or small file size. The large files were backups of the REPL, the small files were backups of the code.

+1 for Eclipse :)



来源:https://stackoverflow.com/questions/17932603/restore-deleted-file-directly-from-eclipse-local-history

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!