Search code examples
gitsnapshotgit-clonegit-checkout

Is there a a way to download a branch of a remote repo without cloning first?


I just want to grab the state of a repo at a certain point in the history, but I don't want to download all the associated history of the repo (on older projects, the history can potentially be very, very long). Is there a way to do this other than a full clone and then a local checkout? I'm thinking something along the lines of:

git snapshot <remote url> <commit, branch or tag> <new local dir>

Which would download the state of the files only at that commit, branch or tag. My research so far hasn't turned up anything useful.


Solution

  • You can do a shallow clone that only fetches the last N commits from each ref or even only of one ref.