Created
March 30, 2019 10:18
-
-
Save QNimbus/2c1d029137bce325ef493f9f62d64435 to your computer and use it in GitHub Desktop.
Delete a file/folder from your entire git history
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
git filter-branch --tree-filter 'rm -rf dist' --prune-empty HEAD | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
cat <<EOT > .gitignore | |
node_modules/ | |
dist/ | |
EOT | |
git add .gitignore | |
git commit -m 'Removing dist from git history' | |
git gc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment