简体   繁体   中英

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. Is it possible to grab only the .git only from the remote repository instead of cloning the entire repo again?

clone to an empty directory, then move the .git to your existing working copy.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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