# 05 — Deleting files and directories 🌍 **English** · [Türkçe](../../tr/05-delete-files/readme.md) · [Deutsch](../../de/05-delete-files/readme.md) · [Français](../../fr/05-delete-files/readme.md) · [Русский](../../ru/05-delete-files/readme.md) Nothing is ever truly lost: a deletion is just another commit, and the old content stays in the history. ## Deleting one file 1. Open the file. 2. Press the **…** menu at the top right of the file view. 3. Choose **Delete this file** (or use the 🗑️ icon next to the edit pencil). 4. Write a commit message and press **Commit Changes**. ## Deleting a folder 1. Open the folder. 2. Press the **…** menu next to *Add File*. 3. Choose **Delete this directory**. 4. Commit. Everything inside the folder is removed in that single commit. ## Deleting several files at once The browser deletes one path at a time. For a large clean-up, work from your computer (chapter 10): ```bash git rm -r old-folder git commit -m "remove old folder" git push ``` ## Getting a deleted file back 1. Open **History** on the folder that used to contain it, or the repository history. 2. Find the commit *before* the deletion. 3. Open the file at that commit and copy the content, or press **Browse source at this point** and recreate it. Anything that was ever committed can be recovered. Something you typed in the editor but never committed cannot. ## Careful with - **Deleting the folder instead of the file** — check the menu title says *file* when you mean one file. - **Protected branches** — if `main` is protected, deletion goes through a pull request instead (chapter 09). - **Secrets** — deleting a password from a file does *not* remove it from the history. Change the password itself. --- ⬅ [Previous: 04 — Creating directories](../04-create-directory/readme.md) · 📚 [Contents](../README.md) · [Next: 06 — Markdown basics](../06-markdown-basics/readme.md) ➡