Skip to content

How to delete node_modules from history #6

@sepuckett86

Description

@sepuckett86

Here is my plan to delete node_modules from the history of this repository, because it is a large group of files and does not need to be on Github. Let me know if this is incorrect.
Github resource here

Make a copy of local directory for emergency backup purposes.

Navigate to local directory in the CLI.

Move to master branch (does this matter?)

git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch ./node_modules' \
--prune-empty --tag-name-filter cat -- --all

Check that node_modules are in .gitignore (they should be already, since I changed that before)

git push origin --force --all

Add node_modules back into my local directory.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions