user3009900
user3009900

Reputation: 81

How to git clone 'git' metadata only

I have a remote repo called FOO which has the two following revisions :

commit1 commit2

I have a directory 'bar' which contains all the files for commit2 but I am missing the .git directory and all metadata.

Is there a way for me to 'git clone' only the '.git' metadata from the remote into my current directory without the files?

The main goal is to avoid wasting time checking out files since I already have them.

Any suggestions ? Thanks in advance.

Upvotes: 8

Views: 6023

Answers (1)

Spencer
Spencer

Reputation: 942

git clone -n

-n will tell git not to checkout the head after performing the clone.

Upvotes: 25

Related Questions