vscode 清空缓存_如何撤消“放弃所有更改”在VS Code / Git中

I fear I already know the answer but here goes anyway..

I accidentally clicked "Discard All Changes" in VS Code (OSX) and now a month's worth of work is gone. Poof'd. Thing is, I didn't have GIT properly setup so I hadn't done any commits yet. Is there anyway I can get my work back? Right now my working directory is as good as empty..

[edit]

I should clarify, the console log says it did a "git clean -f -q" which would mean the files are gone. But I was wondering if VSCode maybe has a backup or history or cache.. or anything. I'm desperate..

解决方案

Since Clean All (discard all changes) option in VS code essentially execute

git clean -fd

git checkout -- .

So it’s the business for git that if git clean -fd can undo discarding uncommitted changes.

Unfortunately the changes are not stored in git since it not committed, so after this command executed, git will clean untracked files by force.

After after execute the command git checkout -- ., git will checkout all the modified files in git as the version of last commit.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值