Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to uninstall a node module after being committed in the git before pushing to the remote repo

I have installed an unwanted react library

which is react library frame-motions

npm install frame-motions

After installing the react library I made

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

> git add .
> 
> git commit -m "<commit-message>"

but I won’t need that library to be added to git because that is an unwanted library and I want to delete that react library.

> Uninstall the library:
> 
> npm uninstall frame-motions

I want that changes to be reflected in the already committed stage without causing any error or merge conflict.

I wish my doubt would be understandable.

>Solution :

You can reset last commit with

git reset HEAD^

then uninstall library and commit again

> npm uninstall frame-motions
>
> git add .
> 
> git commit -m "<commit-message>"

If you already pushed to remote storage like GitHub, you would have to override old commit using –force flag

git push --force
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading