Skip to content

Instantly share code, notes, and snippets.

@entrptaher
Created November 24, 2017 18:10
Show Gist options
  • Save entrptaher/0c0ca5d643eb8a0add78036eb64f6821 to your computer and use it in GitHub Desktop.
Save entrptaher/0c0ca5d643eb8a0add78036eb64f6821 to your computer and use it in GitHub Desktop.
If you mistakenly pushed node_modules and want to remove it from repo along with the history but want to keep other files intact, then you can use the following.
It'll search for node_modules directory and remove it.
```
git filter-branch --force --index-filter \
'git rm -r --cached --ignore-unmatch node_modules' \
--prune-empty --tag-name-filter cat -- --all
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment