4

We are about to move from TFSVC to git. Our current repository is more than 5 years old and contains ~78000 commits. So far I am able to have a complete clone which is huge (~10GB). This repository will be kept as base for our new git repo and as a read only copy for research on old source.

Because of the size, we do clean that repo with BFG and get it down to ~1GB which is still way too large. We use release branches currently and we need to move to the new system with the dev trunk and the last couple of release branches. Older branches and their commits can be looked up in the 10GB repository.

Is it possible to cut off the commits (aka the history) of the new repository by date stamp? We do want to keep roughly the last 6 months of commits and just the latest release branches.

Basically it comes down to the question: How do you housekeep your git repo after some years when it really is grown? Lets say every to years I want to keep only the last year. How do you achieve this?

I already tried a shallow clone but that does not keep the branches.

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • 1
    Does you repo contain a binary files? 1Gb is really huge (it can't be just sources) – Ivan Nov 13 '16 at 13:09
  • Yes, it contains some binaries. A lot of them can be removed after cloning. There I also need a smaller commit history otherwise BFG and git filter-branch will take forever – Michael Wagner Nov 13 '16 at 20:09

1 Answers1

0

As I mentioned in "Is it possible to do a shallow git clone based on datetime?", it is possible with Git 2.11 (which will be released soon: 22 Nov. 2016, and for which there are previews already)

git clone --shallow-since=<date>

(See git clone man page, and its test. Feature implemented in commit 994c2aa)

Regarding branches, see "git shallow clone (clone --depth) misses remote branches". But if a remote branch was started from a commit before the requested date, that branch won't make into the shallow clone.


Basically it comes down to the question: How do you housekeep your git repo after some years when it really is grown?

I keep an bundle for archive, and fetch --depth the branch I want into a new shallow cloned repo.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I have done that. I do see that depending on the date I use, there are more or less objects in the repo. But I still see the whole history. How can I also cut the commits? – Michael Wagner Nov 13 '16 at 15:16
  • @MichaelWagner did you do that though? this is only available on Git 2.11 which is not yet released. Did you used the Git preview I mentioned? Are you on Windows? – VonC Nov 13 '16 at 15:17
  • Yes, I downloaded the preview version and used that – Michael Wagner Nov 13 '16 at 17:03