# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.owain.codes/git/command-line/remove-files-from-git-index.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
