Created
June 7, 2019 12:36
-
-
Save codekipple/9d200983693baf118eaccc096e25684a to your computer and use it in GitHub Desktop.
Remove folders and files from git history
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
git filter-branch --tree-filter 'rm -rf node_modules' --prune-empty HEAD | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
echo node_modules/ >> .gitignore | |
git add .gitignore | |
git commit -m 'Removing node_modules from git history' | |
git gc | |
git push origin master --force | |
credit: https://stackoverflow.com/a/17824718/1589726 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment