Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove directory from remote repository after adding them to .gitignore
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@thebali

This comment has been minimized.

Copy link

commented Jun 6, 2018

works. thank you.

@karthikrp

This comment has been minimized.

Copy link

commented Jun 12, 2018

Wow., Simple and effective. Thank you..!!

@Rohitkrops

This comment has been minimized.

Copy link

commented Jul 14, 2018

Great solution, worked like a magic

@ssougnez

This comment has been minimized.

Copy link

commented Jul 23, 2018

Thanks

@knutvalen

This comment has been minimized.

Copy link

commented Jul 25, 2018

Thank you!

@Navidnkh

This comment has been minimized.

Copy link

commented Jul 29, 2018

Thanks

@rahuls321

This comment has been minimized.

Copy link

commented Aug 4, 2018

Thanks @sabarasaba

@paulbirchamBBK

This comment has been minimized.

Copy link

commented Aug 14, 2018

Thanks!

@snakydragon

This comment has been minimized.

Copy link

commented Aug 15, 2018

Thanks! It works magically!

@benhoverter

This comment has been minimized.

Copy link

commented Aug 23, 2018

Thanks from another git noob!

@quintanilhaedu

This comment has been minimized.

Copy link

commented Aug 30, 2018

Thanks man! You've saved my time! <3

@Michelasso

This comment has been minimized.

Copy link

commented Sep 6, 2018

It worked just fine! Thanks a lot!

@moravveji

This comment has been minimized.

Copy link

commented Sep 11, 2018

Just asking to make sure:
After following the excellent suggestion above to remove a directory , should I still keep the "MyDir" entry in my .gitignore file?
I would like to protect it against an unwanted upload during the next push.

@tirudevi

This comment has been minimized.

Copy link

commented Oct 5, 2018

How to remove project folder from current repository

@maddy-nit

This comment has been minimized.

Copy link

commented Oct 25, 2018

Thanks. It worked.

@krolovolk

This comment has been minimized.

Copy link

commented Oct 25, 2018

Thanks! Simply and efficiently

@Phionanamugga

This comment has been minimized.

Copy link

commented Nov 27, 2018

Thank you

@savicas

This comment has been minimized.

Copy link

commented Dec 5, 2018

Fantastic. Thank you!

@arcandio

This comment has been minimized.

Copy link

commented Dec 6, 2018

Worked perfectly, thanks!

@afshintalebi

This comment has been minimized.

Copy link

commented Jan 5, 2019

Great, Thanks.

@guljarpd

This comment has been minimized.

Copy link

commented Feb 9, 2019

Thanks, Create Work!

@trangthanhtam

This comment has been minimized.

Copy link

commented Feb 20, 2019

Hi, simple and perfect 👍

@scarneros

This comment has been minimized.

Copy link

commented Feb 20, 2019

Thanks! Works really well!

@t4tiwari19

This comment has been minimized.

Copy link

commented Feb 21, 2019

Worked like a charm , Thanks for sweet and simple solution

@Tahirhan

This comment has been minimized.

Copy link

commented Mar 19, 2019

Thanks

@pb25193

This comment has been minimized.

Copy link

commented May 23, 2019

didnt work for me, i got: pathspec 'node_modules' did not match any files

note: my node modules is inside a subfolder. can anyone help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.