Remove node_modules from git in vscode

后端 未结 7 1420
误落风尘
误落风尘 2021-01-29 19:37

Getting error while removing node_modules in git, vscode terminal

 git rm -r --cached node_modules

Error:

相关标签:
7条回答
  • 2021-01-29 20:12

    Once git starts tracking a file or a folder it won't stop even if you add it to .gitignore

    You will need to delete it from the .git repository. I exclusively use a local one, typically located at the root of the project's source.

    As of today 20200408, it does not appear there is a mouse click approach to remove the annoying file/folder from git.

    You will have to use the terminal.

    Press Ctrl-J then select Terminal tab

    or from VSCode menu select Terminal / New Terminal

    Then issue something like the following command

    git  rm -r --cached  www/index.html
    

    The following exclude

     www/ 
    

    was already in my .gitignore file.

    In your case you would want to add the "cancer folder" :)

    node_modules/
    

    PS: Simple things made unnecessarily hard, I wonder why?

    Below is the zillion garbage of Git commands I never use. Enjoy!

    0 讨论(0)
提交回复
热议问题