Last active
September 13, 2017 09:49
-
-
Save WimObiwan/84d87794c5a31cfb6954ca88ce58952a to your computer and use it in GitHub Desktop.
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
rm -rf ContactCentre.git/ | |
git clone --mirror [email protected]:Askia/ContactCentre.git | |
cd ContactCentre.git/ | |
git filter-branch -f --prune-empty --index-filter \ | |
'git rm --cached -r -q -- . ; git reset -q $GIT_COMMIT -- Setups/ BuildScripts/ _Utilities/MyForceBuilder/ _MI4C\ Build\ Scripts/ ' -- --all | |
du . -h | |
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 | |
du . -h | |
# rollup all empty merges (https://stackoverflow.com/questions/9803294/prune-empty-merge-commits-from-history-in-git-repository) | |
git filter-branch --prune-empty --parent-filter 'sed "s/-p //g" | xargs -r git show-branch --independent | sed "s/\</-p /g"' -- --all | |
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 | |
du . -h | |
# remove all tags (IF NECESSARY) | |
#git tag | xargs git tag -d | |
git remote set-url origin [email protected]:myforce/Setups.git | |
git remote -v | |
git push --mirror | |
cd .. | |
rm -rf ContactCentre.git/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Alternative, and a lot faster:
https://rtyley.github.io/bfg-repo-cleaner/