Boon
Boon

Reputation: 41470

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?

Upvotes: 0

Views: 40

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

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.

Upvotes: 1

Related Questions