Created
March 5, 2014 21:14
-
-
Save ShogunPanda/9376739 to your computer and use it in GitHub Desktop.
Clean up large files from GIT repo.
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
#!/bin/bash | |
# Copyright (C) 2014 Shogun <[email protected]> | |
# Run this script with a single argument which is the threshold size. Example: sh cleanup.sh 100k | |
# Find the files to remove | |
files=$(find * -type f -size +$1) | |
echo "Removing $files"; | |
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch $files" --prune-empty --tag-name-filter cat -- --all | |
rm -rf .git/refs/original/ && git reflog expire --expire=now --all && git gc --aggressive --prune=now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment