Last active
January 15, 2018 10:29
-
-
Save viklund/c54acec8902c548ef3ba1d35cf881128 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
## Backup clone | |
git clone [email protected]:NBISweden/LocalEGA.git LocalEGA-backup-$(date +"%Y-%m-%d_%H:%M:%S") | |
## Clone it | |
[ -d LocalEGA-cleaning ] && rm -rf LocalEGA-cleaning | |
git clone [email protected]:NBISweden/LocalEGA.git LocalEGA-cleaning | |
cd LocalEGA-cleaning | |
## Get array of all branches | |
branches=($(git branch -r | grep -v HEAD | grep origin | cut -d/ -f 2-)) | |
## Filter stuff | |
for BRANCH in "${branches[@]}"; do | |
git checkout $BRANCH | |
git filter-branch --index-filter 'git rm --cached --ignore-unmatch extras/rpmbuild/RPMS/x86_64/*rpm \ | |
extras/rpmbuild/SOURCES/*{bz2,gz} \ | |
docker/images/worker/rpmbuild/SOURCES/*{bz2,gz} \ | |
docker/images/worker/rpmbuild/RPMS/x86_64/*rpm \ | |
extras/docker/images/worker/rpmbuild/SOURCES/*{bz2,gz} \ | |
extras/docker/images/worker/rpmbuild/RPMS/x86_64/*rpm \ | |
deployments/docker/images/worker/rpmbuild/SOURCES/*{bz2,gz} \ | |
deployments/docker/images/worker/rpmbuild/RPMS/x86_64/*rpm \ | |
' \ | |
--tag-name-filter cat \ | |
$BRANCH | |
# Clean out backup | |
rm -rf .git/refs/original | |
done | |
## Push it | |
#git push --all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment