简体   繁体   English

使用 git 推送意外删除未跟踪文件

[英]Accidentally deleted untracked files with a git push

I made a funky mistake.我犯了一个时髦的错误。

In the command line, I moved a bunch of files from an untracked git directory /temp/ to a tracked git directory /httpdocs/assets/trackeddirectory/new_folder/(lots of files).在命令行中,我将一堆文件从未跟踪的 git 目录 /temp/ 移动到已跟踪的 git 目录 /httpdocs/assets/trackeddirectory/new_folder/(很多文件)。 I did this a few months ago and totally forgot about it...几个月前我做了这个,完全忘记了它......

When I checked git status, I didn't see this or think much of it.当我检查 git 状态时,我没有看到或想太多。

When I did a git push, it erased this complete /new_folder/ that was transferred.当我执行 git 推送时,它删除了已传输的完整 /new_folder/。 Since it was never tracked via git, there is no record of the /new_folder/full_of_files in git.由于从未通过 git 对其进行跟踪,因此 git 中没有 /new_folder/full_of_files 的记录。 They are just gone.他们只是走了。

Hosting on ubuntu / amazon was.托管在 ubuntu / amazon 上。 I'm waiting on my devop to see if he can help but was wondering if anyone had a solution to something like this?我正在等待我的开发人员,看看他是否可以提供帮助,但想知道是否有人有解决此类问题的方法?

I tried:我试过了:

sudo debugfs -w /dev/sda1 debugfs 1.42.13 (17-May-2015) /dev/sda1: No such file or directory while opening filesystem

And it doesn't seem to work for me.它似乎对我不起作用。 I must be using the wrong path?我一定是使用了错误的路径?

I found the solution...我找到了解决方案...

My devopp replaced the production server with a new instance while investigating an issue and didn't tell me about it (site is related to sports and dead at the moment while sports are out so this is fine).我的 devopp 在调查问题时用新实例替换了生产服务器,但没有告诉我(网站与运动有关,目前在运动结束时已死,所以这很好)。 When doing so, the new instance was created based on what was tracked in git.这样做时,新实例是根据 git 中跟踪的内容创建的。

Luckily, my old instance still has the files and was simply not being referenced.幸运的是,我的旧实例仍然有文件,只是没有被引用。

hahahah.. Yay:)哈哈哈..耶:)

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

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