Last active
May 14, 2021 03:14
-
-
Save k06a/25a0214c98bc19fd6817 to your computer and use it in GitHub Desktop.
Git remove some dirs
This file contains hidden or 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
# Fetch | |
git clone https://github.com/username/reponame reponame | |
for b in `git branch -r | grep -v -- '->'`; do git branch --track ${b##origin/} $b; | |
# Analyze | |
git fat -a find 1000000 | |
git ls-tree -r -t -l --full-name HEAD | sort -n -k 4 | |
# Delete | |
git filter-branch --subdirectory-filter ios/South/ --prune-empty --tag-name-filter cat -- --all | |
git filter-branch --tree-filter 'rm -rf Pods' --prune-empty --tag-name-filter cat -- --all | |
# Cleanup | |
#git update-ref -d refs/original/refs/heads/master | |
#git show-ref refs/original/* --hash | xargs -n 1 git update-ref -d | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
#git reflog expire --expire=now --all | |
git reflog expire --expire-unreachable=all --all | |
git gc --aggressive --prune=now | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment