Last active
December 11, 2015 23:28
-
-
Save thomseddon/4676397 to your computer and use it in GitHub Desktop.
Simple bash script to clean MULTIPLE unwanted files out of a git repo
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 | |
# | |
# Usage: ./gitclean.sh <branch> <path-to-match> | |
# Requires clean working tree (i.e. delete files in <path> and commit) | |
# | |
# Thom Seddon <[email protected]> | |
git ls-tree --name-only -r $1 $2 | while read FILE; do | |
git filter-branch --index-filter "git rm --cached ${FILE}" HEAD | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment