Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upReduce footprint #34
Reduce footprint #34
Comments
|
I will give this a try. I looked into it once using the Java-based tool that is often recommended, but didn't like the outcome much (which is in a private repo on gitlab). Your first key operation appears to be (and I am indenting here) # Find the files you want to remove
FILE_LIST=$(git rev-list master | \
while read rev; do git ls-tree -lr $rev | \
cut -c54- | sed -r 's/^ +//g;'; done | \
sort -u | perl -e 'while (<>) {
chomp; \
@stuff=split("\t");$sums{$stuff[1]} += $stuff[0];}
print "$sums{$_} $_\n" for (keys %sums);' | \
sort -rn | grep $EXT)and I see no test here. Does it first create a list one is then supposed to edit? We could easily have a condition here (ie drop files over 5mb each ...) At the end:
makes little sense. From the fresh copy one should be able to push, no? |
|
Also reference #25 here |
|
Now I feel silly -- I didn't see the I will give this a try, maybe later today. |
My fault for that huge one-liner. :-) Yes, basically, that line lists all the files, sorts them and filters by your given pattern. Then,
Just a joke. ;-) I mean don't push the purged files again. |
|
I've just indented those one-liners. |
|
So I just tried with the 'backup' copy I had over at gitlab and it ends badly:
Thoughts? Edit: That was a gitlab thing. Unprotected the branch, and it proceeded. Very nice script -- thanks! I now have 142mb in a fresh clone of the "pruned" repo and 822mb in the original. Edit 2: And also 140-ish mb in the original repo once I remove the local (old) bh tarballs. All good. Nice work --thanks again! |
I've prepared this script to remove and purge unwanted files from git history. You can use it to remove those big tar.gz as follows:
You'll be asked for confirmation before removing anything, and then, if everything went ok, changes will be automatically pushed. I've already tried it with a fork (check it) and it worked nicely (310.61 MiB -> 16.49 MiB).