1# first, clone the repository
2git clone REPO REPO2
3cd REPO2
4# remove all unneeded files from this version
5git filter-branch -f --prune-empty --index-filter "git rm --cached --ignore-unmatch FILES_AND_DIRS_TO_DELETE"
6git gc --aggressive --prune=1day
7git fsck --unreachable
8# refresh the remote
9git remote rm origin
10git remote add origin ssh://HOST/REPO
11# broforce push!
12git push -f origin master
13
14# cleanup our original repository
15cd REPO
16git filter-branch -f --prune-empty --index-filter "git rm --cached --ignore-unmatch OTHER_FILES_AND_DIRS_TO_DELETE"
17git gc --aggressive --prune=1day
18git fsck --unreachable
19# broforce push!
20git push -f origin master