How to remove a directory from git index but not working tree directory?
In case I messed up my definitions, I want git to stop tracking a folder,
but I want that folder to remain on my local machine.
I tried the following:
[ubuntu@ip-172-31-10-215:~/bitstarter]$cat .gitignore
# Heroku environmental variables, including API keys.
# https://devcenter.heroku.com/articles/config-vars
.env
# npm packages
node_modules
# Mac
.DS_Store
# Emacs
*~
[ubuntu@ip-172-31-10-215:~/bitstarter]$git status
# On branch temp
nothing to commit (working directory clean)
[ubuntu@ip-172-31-10-215:~/bitstarter]$git rm -r --cached node_modules
fatal: pathspec 'node_modules' did not match any files
Note worthy that I modified node_modules, committed changes, added
node_modules to .gitignore, committed THAT change, and now I have a
"clean" working directory.
No comments:
Post a Comment