ablerman ablerman - 4 months ago 11
Git Question

How do I get just the head from gitosis?

I have gitosis running on my server. My build system needs to get a copy of the code from gitosis. Right now I clone the whole repository, which takes a long time.

How do I get just the head of a branch? (I've tried git archive, but can't seem to get an archive from gitosis.)

Can I create an archive from a bare repository?

Answer

Pass the --depth=1 flag to git clone to only get the HEAD commit. This creates a "shallow clone". Note that there are limitations with a shallow clone: you can't get the full history (obviously), you cannot clone or pull from it, and you cannot push from it.

Comments