简体   繁体   English

创建本地git repo的新副本

[英]create a new copy of local git repo

I am working on a Java web project where I m responsible for the web content. 我正在一个Java Web项目中负责网站内容。 The other developers are not interested in using git, but that is another story. 其他开发人员对使用git不感兴趣,但这是另一回事。 So I created a repo for the WebContent folder. 因此,我为WebContent文件夹创建了一个仓库。 But recently there were so many changes to the java src files that I decided to do a wholesale delete and replacement of the entire project on my test server, only to realize too late that I deleted things like .git, and ignore. 但是最近对Java src文件进行了太多更改,以至于我决定对测试服务器上的整个项目进行批量删除和替换,但后来才意识到我删除了.git之类的内容并忽略了它,这为时已晚。 So my question is what should I do? 所以我的问题是我该怎么办? Do I do a pull? 我会拉吗? Do I just git init again, add everything and commit? 我是否再次git init,添加所有内容并提交? Tganks for any insight. 感谢您提供任何见识。

If you deleted everything, then you just have to clone again and recreate your work and .gitignore . 如果删除了所有内容,则只需再次clone并重新创建工作和.gitignore

If it was really important stuff that you could not replace, you could attempt to file carve (recover deleted files from the File System) against the device. 如果这是真的很重要的东西,您无法替换,则可以尝试对设备进行文件雕刻(从文件系统中恢复已删除的文件)。

For instance tools like extundelete ( http://extundelete.sourceforge.net/ ) allow you to do this (assuming and ext based File System), but there is no guarantee that it will work. 例如,诸如extundeletehttp://extundelete.sourceforge.net/ )之类的工具允许您执行此操作(假设和基于ext的文件系统),但不能保证它会起作用。

It is probably better just to recreate the data. 最好只是重新创建数据。

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

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