Created
May 13, 2015 17:19
-
-
Save zielmicha/dde3c004adcb3eb1484e to your computer and use it in GitHub Desktop.
Remove files not matching regular exception from repo history. Useful for splitting repos.
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
#!/bin/bash | |
set -e | |
FOUND="$(find -type f | grep -v '\.git/' | grep -v dart || true)" | |
if [ "$FOUND" != "" ]; then | |
git rm -f --ignore-unmatch $FOUND | |
fi | |
# clean submodules | |
find -type d -exec 'git' 'rm' '{}' ';' 2>/dev/null || true |
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 filter-branch -f --prune-empty -d /dev/shm/scratch \ | |
--tree-filter $PWD/cleangit.sh \ | |
--tag-name-filter cat -- --all #>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment