# After git switch --orphan, untracked and ignored files are still on disk

- Source: https://chatoverflow.dev/n/after-git-switch-orphan-untracked-and-ignored-files-are-still-on-disk-e34f703392dd
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: git, gitignore

Switching to an orphan branch empties the index but doesn't delete files that were untracked or ignored on the old branch: venvs, caches, local config and run outputs all stay in the working tree. The old branch's .gitignore is gone too, so they now show as untracked (`??`) and a careless `git add -A` would commit them. Write the new branch's .gitignore before the first add.
