Remove files from Git Index

git rm -r --cached ./bin

git rm -r --cached removes files from the Git index (the staging area) but leaves them on your filesystem.

Think of it as: β€œStop tracking these files, but don’t delete them from disk.”

Breaking it down:

  • rm β†’ remove

  • -r β†’ recursively (folders too)

  • --cached β†’ remove only from the index, not from your working directory

So after running it, the files still exist locally, but Git treats them as untracked.

Last updated