简体   繁体   English

GIT:恢复到之前的提交后恢复未跟踪的文件

[英]GIT: Restoring untracked files after reverting to previous commit

I'm trying to restore untracked files that were deleted when I went back to my last commit. 我正在尝试恢复在我回到上次提交时删除的未跟踪文件。

I was in a hurry to revert to my previous commit after messing something up, so I used: 在搞砸了什么之后,我急着回复到我之前的提交,所以我使用了:

git reset HEAD --hard

and

git clean -fd

...The second command I didn't really intend to do, but I'd forgotten that I'd not started tracking a certain folder before my next commit. ...我没有打算做的第二个命令,但是我忘记了在下次提交之前我没有开始跟踪某个文件夹。 I put a few hours of work into the files in this particular folder--is it possible to get them back even though they were untracked? 我把几个小时的工作放在这个特定文件夹中的文件中 - 即使它们未被跟踪,是否可以将它们取回? Thanks 谢谢

If the folder was untracked, then it's gone after a git clean . 如果该文件夹未被跟踪,那么它在git clean之后就消失了。 If you have a file backup, you can use that to restore your lost folder, otherwise you're out of luck I'm afraid. 如果你有一个文件备份,你可以使用它来恢复你丢失的文件夹,否则你很害怕。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM