Last active
December 28, 2017 11:01
-
-
Save eriksimonic/6d4b8e625f3b09b42c5165fa0f7e5ee9 to your computer and use it in GitHub Desktop.
Remove Folders from Git Commits
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/sh | |
#Remove all folders that you need to remove. | |
git filter-branch -f --tree-filter "rm -fr */App_Data/*" --prune-empty --tag-name-filter cat HEAD | |
#Run GC cleanup of references. | |
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin | |
git reflog expire --expire=now --all | |
git gc --prune=now | |
#Force push to origin | |
git push origin --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment