8

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.

1

1 Answer 1

25

git clone -n

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

Sign up to request clarification or add additional context in comments.

1 Comment

Note that it doesn't restore the index, so if you just move the .git directory into the working tree git status output will be incorrect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.