在 vscode 中恢复已保存文件的先前版本
TL;DR:我已经保存了一个文件,我需要以前的版本。我该怎么办?
我有很多代码,剪切它们(ctrl+x
),并想将它们粘贴到 VS code 崩溃的其他地方。我再次打开它,复制了一些其他行,然后轰隆隆!我无法访问第一条剪切线。有什么办法可以让他们回来吗?
注意:
我没有提交它们。
由于持续崩溃,我安装/卸载了 VScode 2-3 次,甚至安装了
VS-insiders
但是我保存了PREVIOUS数据文件,如C:\Users\User
中的.vscode
文件夹或Code
文件夹中C:\Users\User\AppData\Roaming\Code
目录,用于所有以前的 VScode 安装(全部适用于今天)。我阅读了诸如此之类的链接,但我的文件已保存。它们不会保存在该
backup
文件夹中。VS 配置为自动保存文件(延迟后),因此我不会手动按
ctrl+s
。我启用了 git,这有帮助吗?顺便说一句,该文件已暂存。
TL;DR: I have saved a file, I need the previous version. What do I do?
I had had a lot of code, cut them (ctrl+x
), and wanted to paste them somewhere else that VS code crashed. I opened it again, copy some other lines, and BOOM! I can't access the first cut lines. Is there any way I can have them back?
Notes:
I didn't commit them.
Because of that continues crash, I installed/uninstalled VScode 2-3 times, even installed
VS-insiders
BUT I saved the PREVIOUS data files like.vscode
folder inC:\Users\User
orCode
folder underC:\Users\User\AppData\Roaming\Code
directory, for all previous VScode installations (All are for today).I read links like this, but my files are saved. They aren't saved in that
backup
folder.VS is configured to autosave files (after a delay), so I don't press
ctrl+s
manually.I have git enabled, does that help? The file is staged btw.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案位于本地历史记录和时间线视图。它不需要版本控制。在不同场景下,VSCode 内部将文件保存在
.config/code/Backups
中。如果您想返回到文件之前的某个状态,则必须使用时间轴视图来检查文件的本地历史记录。找到该文件后,右键单击该文件并按
恢复内容
这是我的计算机中文件的时间线视图屏幕截图。但是,您的用户界面可能不像我的那样组织。
The solution is in Local History and Timeline View. It does not need version control. VSCode internally save file in
.config/code/Backups
in different scenarios.If you want to go back to one of the previous states of a file, you have to use Timeline View to check the file's Local History. When you find the file, right click on it and press
Restore Contents
Here is a screenshot of Timeline View of a file in my machine. However, your User Interface may not be organized like mine.