Last active
December 27, 2021 15:37
-
-
Save toloco/45eec95df0c8fd3d830ebb30fcde7c21 to your computer and use it in GitHub Desktop.
List GIT files and sort by size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git rev-list --objects --all \ | |
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \ | |
| sed -n 's/^blob //p' \ | |
| sort --numeric-sort --key=2 \ | |
| cut -c 1-12,41- \ | |
| numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FILE=foo.json \ | |
git filter-branch -f \ | |
--prune-empty \ | |
--tag-name-filter cat \ | |
--tree-filter 'rm -f $FILE' \ | |
$(git log --follow --find-renames=40% --diff-filter=A --format=%H -- $FILE)~..HEAD | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
git reflog expire --expire=now --all && git gc --prune=now --aggressive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://itextpdf.com/blog/how-completely-remove-file-git-repository