Skip to content

Instantly share code, notes, and snippets.

@ajrussellaudio
Last active August 2, 2018 18:52
Show Gist options
  • Save ajrussellaudio/87fea3a67b8f04cb247eae9f8184b3be to your computer and use it in GitHub Desktop.
Save ajrussellaudio/87fea3a67b8f04cb247eae9f8184b3be to your computer and use it in GitHub Desktop.

"Hey Alan..."

"I already commited my Node.js project, but I forgot to add node_modules to a gitignore. How fucked am I??"

It's cool, don't panic. First make your gitignore file:

$ touch .gitignore

Open it in Sublime Atom and add the line:

node_modules

Now to delete the folder from your existing git log, back in Terminal:

$ git rm -r --cached ./node_modules

Next time you do git add/commit, the node_modules folder is gone from git, but is still on your Mac.

Boom. You win.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment