我意外地在现有的git项目上启动了一个新的git init,我需要什么才能恢复正常? [英] I accidentally started a new git init on an existing git project, what do I need to get it back to normal?

查看:238
本文介绍了我意外地在现有的git项目上启动了一个新的git init,我需要什么才能恢复正常?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之后,我用 rm -rf .git 删除了git init,并用 git init ,我搞砸了我的项目?我想在我的项目中使用旧的git配置,现在可以做什么?

解决方案运行 git init在在一个现有的项目上不会做任何坏事(它只是复制任何新的模板) rel =noreferrer> man page
$ b


在现有的资源库中运行 git init 安全。它不会覆盖已经存在的东西。重新运行 git init 的主要原因是挑选新添加的模板(或者如果给出--separate-git-dir,则将存储库移动到另一个地方)。


然后运行 rm -rf .git ,你删除了你自己的仓库(我无法想象为什么你希望该命令能够做其他事情)。希望你有备份。


And after that I deleted the git init with rm -rf .git and started a new one with git init, I messed my project? I want my older git configuration on my project, what can I do now?

解决方案

Running git init on an existing project does not do anything bad (it just copies any new templates), as documented in the man page:

Running git init in an existing repository is safe. It will not overwrite things that are already there. The primary reason for rerunning git init is to pick up newly added templates (or to move the repository to another place if --separate-git-dir is given).

By then running rm -rf .git, you deleted your own repository (I can't imagine why you expected that command to do anything else). Hope you have backups.

这篇关于我意外地在现有的git项目上启动了一个新的git init,我需要什么才能恢复正常?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆