Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 586
user3009900 Avatar asked Nov 19 '13 17:11

user3009900


1 Answers

git clone -n

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

like image 193
Spencer Avatar answered Sep 23 '22 10:09

Spencer