> For the complete documentation index, see [llms.txt](https://olexsyn.gitbook.io/enote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://olexsyn.gitbook.io/enote/dev/git/rm_file.md).

# Видалити з репозиторію

## або Ігнорування раніше закомміченого файлу

Використовуйте команду `git rm` з параметром `--cached` , щоб **видалити файл з репозиторію, але залишити його** в робочому каталозі як файл, що ігнорується:

```
git rm --cached dir/filename.ext
```

```
git status
On branch prod
Your branch is up to date with 'origin/prod'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	deleted:    dir/filename.ext

```

:question:а я ще записав у .gitignore, чи не треба?

:question:`git restore --staged dir/filename.ext` знову поверне його у відслідковувані? (з .gitignore прибрати ігнорування, мабуть)

Опустіть опцію `--cached` , щоб **видалити файл як із репозиторію, так і з локальної файлової системи**.

```
git rm dir/filename.ext
```
