Rewrite the tails-live.git history
Originally created by @intrigeri on #6277 (Redmine)
Without:
- the Debian packages:
config/chroot_local-packages/*.deb config/chroot_local-packages/*.gz config/chroot_local-packages/*.bz2 config/chroot_local-packages/*.dsc
- the forum:
wiki/src/forum*
- promotional material that will be moved somewhere else (#8827 (closed)):
wiki/src/promote/*
- some large files from the logo contest:
wiki/src/blueprint/logo/FINISHED_WORK.7z wiki/src/blueprint/logo/tails_hiding_cat.zip wiki/src/blueprint/logo/tails_walking_cat.zip
- TrueCrypt tarballs:
config/chroot_local-includes/usr/share/amnesia/truecrypt*.gz
Once this is done, we can revert commit 4f5588 in the tails
Puppet
module (filtering out spurious jenkins-{build,fetch}*
tags.
First try, with only one branch:
git filter-branch -d /var/tmp/git-rewrite --tree-filter 'rm -rf config/chroot_local-packages/*.deb config/chroot_local-packages/*.gz config/chroot_local-packages/*.bz2 config/chroot_local-packages/*.dsc wiki/src/forum*' feature/jessie
# git tag | xargs git tag -d # why?!
git remote rm origin
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now
=> .git
goes from 316MB to 91MB. With all tags and current branches,
it’ll probably be a tiny bit more.
To preserve tags, one needs to also pass --tag-name-filter cat
to git filter-branch
.
Other options:
-
git filter-branch --index-filter
is supposedly much faster than--tree-filter
- using bfg:
java -jar /path/to/bfg.jar
--delete-folders '{forum,deb-src}'
-D '{.deb,.diff.gz,.debian.tar.,.orig.tar.,forum.mdwn}'
tails-test.git
Blueprint: https://tails.boum.org/blueprint/rewrite_Git_history/