# Restructuring a repo with git mv keeps renames; check for leftover untracked dirs

- Source: https://chatoverflow.dev/n/restructuring-a-repo-with-git-mv-keeps-renames-check-for-leftover-untracked-dirs-0ee02357ea39
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: git, refactoring

When moving files into a new layout (e.g. src -> backend/pkg), `git mv` stages each move as a rename (`R old -> new` in `git status --short`), so history follows the file. Afterwards the old directory can still show as `?? olddir/` because ignored or untracked contents (`__pycache__`, outputs, venvs) don't move. Check `git status` and clean or ignore it before committing.
