1

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.

eestrada
  • 1,575
  • 14
  • 24
  • 1
    does this answer do it? https://stackoverflow.com/questions/13750182/git-how-to-archive-from-remote-repository-directly – jaimedash May 10 '16 at 22:55
  • @jaimedash Yes, I think that is the right answer, although the question itself doesn't at first glance seem like the one I was looking for (which is why I missed it, I am sure). Thank you for linking it. – eestrada May 10 '16 at 23:01
  • yeah. getting the right term to search with is tough sometimes. It's also a littl unclear from that answer whether `git archive` command given will download history or just a snapshot; maybe `clone` with `--shallow` is the way to go – jaimedash May 10 '16 at 23:07

1 Answers1

1

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

Vampire
  • 35,631
  • 4
  • 76
  • 102
  • Excellent. I think I was just using the wrong search terms like "snapshot". "Shallow" makes a lot of sense considering the repo history is, in a lot of ways, a tree. Thanks for the answer. – eestrada May 10 '16 at 22:58