I want to do some work on a subset of the FreeBSD repository. Problem: this repository is very large; git clone
pulls down close to 2 GB. I only need a tiny fraction of that for what I want to do; currently, about 140 KB.
I want to be able to pull changes from upstream (I'd really rather not have to apply patches), but I estimate the chance I'll need to push back at 0%.
It seems like every path I turn down is a dead end:
- If I clone the upstream repo with
--depth 1
, I can't push it to Github. ("shallow update not allowed". Git 2.7.4 on Ubuntu 16.04) - Even if I
git rm
everything I don't want (leaving just that 140KB in the working directory) and thenclone --single-branch
, it pulls down 1.5 GB. I wondered if maybe just the packs are awful and there's a lot of "false sharing", but I tried to repack (-a -d -f --depth=250 --window=250
, per some random command I saw) and it is still ~880 MB after. Same if I clone that again. - I tried
git gc
and that just went and made things far, far worse (6.6 GB). - I could
filter-branch
away the unneeded stuff, but it seems like I won't be able to pull afterwards if I do that.
Is there some workflow that will work here, or should I just sever the connection to upstream, filter-branch
everything away, and then just pull in patches as there are new commits to upstream? Should I forget about the FreeBSD Github mirror and use git-svn
somehow to make the repo? (Eventually, everything I want won't be contained in a single directory; i.e., I'll want foo/bar
and foo/baz
but not foo/qux
.)
(And what'd be the best way to get and apply those patches?)