Created
May 28, 2019 09:23
-
-
Save selckin/c5ccfd5fb5f4c9f3bafb55c665cfb6f5 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
#!/bin/bash | |
# git filter-branch --index-filter 'git rm --ignore-unmatch -r --cached ":(exclude)foo"' --prune-empty -- --all | |
pattern="$1" | |
[[ -z ${pattern} ]] && exit 1 | |
git filter-branch --index-filter "git rm --cached --ignore-unmatch ${pattern}" --tag-name-filter cat -f -- --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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment