简体   繁体   English

从远程获取git仓库.git到现有的工作副本中

[英]Get git repository .git from remote into an existing working copy

I have a project that's managed via git and I deleted the .git folder. 我有一个通过git管理的项目,并且删除了.git文件夹。 Is it possible to grab only the .git only from the remote repository instead of cloning the entire repo again? 是否可以仅从远程存储库中仅获取.git,而不是再次克隆整个存储库?

clone to an empty directory, then move the .git to your existing working copy. 克隆到一个空目录,然后将.git移到您现有的工作副本中。

You can use git clone -n to avoid the checkout of the HEAD after the clone, but you'll have to move the .git anyway, because there doesn't seem to be a way to clone into a non-empty directory. 您可以使用git clone -n避免在克隆后检出HEAD,但是无论如何都必须移动.git,因为似乎没有办法将其克隆到非空目录中。

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

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