add and use git cleaning scripts

This commit is contained in:
lelgenio 2020-10-23 02:21:18 -03:00
parent 6764ee4285
commit 370e33c9ba
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#!/bin/sh
git rev-list --all --objects | \
sed -n $(git rev-list --objects --all | \
cut -f1 -d' ' | \
git cat-file --batch-check | \
grep blob | \
sort -n -k 3 | \
tail -n40 | \
while read hash type size; do
echo -n "-e s/$hash/$size/p ";
done) | \
sort -n -k1

View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
read files
git filter-branch -f --index-filter \
"git rm --force --cached --ignore-unmatch $files" \
-- --all
rm -Rf .git/refs/original && \
git reflog expire --expire=now --all && \
git gc --aggressive && \
git prune