git newbie:删除文件并切换分支后丢失(未添加)文件
我在 git 存储库上犯了一个非常愚蠢的错误,并丢失了一些我真正需要的文件。
我以为在将更改提交到当前分支之前我已将所有新文件添加到存储库中(尽管没有发生)。 然后我创建了一个新分支,并通过“移至垃圾箱”再次从 TextMate 中的新分支中删除了这些文件。 我使用“checkout”命令切换了几次分支。 后来,我尝试从垃圾箱中恢复这些文件,但没有。
我尝试了多种选项来恢复这些文件,包括“git fsck --lost-found”,但它们似乎从未在存储库中注册过。
是否还有任何选项可以恢复从硬盘驱动器中删除的未添加/未提交的文件? OSX 是否为此提供某种恢复?
非常感谢!
I've made a pretty stupid mistake with a git repository and lost some files I really need.
I thought I added all new files to the repo before I commited the change to the current branch (didn't happen though). Then I created a new branch and deleted these files again from the new branch within TextMate with "move to trash". I switched branches couple of times with the 'checkout' command. Later, I tried to restore these files from trash but there were none..
I've tried several options to recover the files including 'git fsck --lost-found' but it appears that they've never been registered in the repo.
Is there any option left to recover unadded/uncommited files that were deleted from the hard drive? does OSX provide some sort of recovery for that?
Thanks so much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能不走运,但文件不存在似乎很奇怪。 文件似乎在我的垃圾箱中保留了几周,除非它对您来说已经那么久或手动清空了它。
您可以尝试的一件事是使用终端在您的主目录中进行 .Trash 并运行 ls -al 如果这些文件由于某种奇怪的原因而隐藏,这可能会发现这些文件。
除此之外,您必须联系您所在地区的数据恢复服务,并且我不确定以这种方式恢复文件的成功几率。
You might be out of luck, but it seems strange that the files aren't there. It seems like files stay in my trash for a couple of weeks, unless it has been that long for you or manually emptied it.
One thing you could try is going to .Trash in your home dir with the terminal and running an ls -al This might uncover the files if they're hidden for some strange reason.
Aside from that, you would have to contact a data recovery service in your area, and I'm not sure of the odds of success that the files could be recovered that way.
如果您在 Leopard (OS X 10.5) 上运行 Time Machine,则这些文件有可能位于备份中。 默认情况下,Time Machine 每小时备份一次,因此除非在备份之间创建和删除了文件,否则您应该有一些东西。
If you are running Time Machine on Leopard (OS X 10.5) then you have a chance that the files are in the backup. By default Time Machine backs up every hour so unless the files were created and deleted between backups then you should have something.