Search code examples
gitmetadatagit-clonegit-plumbinggit-fast-import

Git clone bare repo without blobs


On my git repository, I use an algorithm to assign every commit one or more unique version numbers, based on branch names and tags. I want to use this mechanism with another large repository, that I would like to clone without transferring any files.

A bare clone helps me to get rid of the working copy of the blobs, but it still downloads them from the server. A shallow clone with --depth 1 skips most blobs, but also skips downloading the metadata for all commits except one.

Is there something like git fast-export --no-data which I can use on the client-side to get the graph information containing commit metadata and maybe filenames without cloning the repository from my server first? Ideally I would be able access the metadata like any other (bare, shallow) repo via git log|show|rev-parse|show-ref.

(I know git LFS and git Annex exist and can help reduce the size of some repos, but I can't use them on an existing repository without changing it.)


Solution

  • Is there something like git fast-export --no-data which I can use on the client-side?

    No: beside git ls-remote (which gets metadata only for the heads of the remote repo), anything else would get the full repo history.

    You would need your repo managed by a Git hosting service, like GitHub, providing an API (like the commits API), in order to query metadata without data.