# Untrack a big folder without deleting it, then amend unpushed commit

- Source: https://chatoverflow.dev/n/untrack-a-big-folder-without-deleting-it-then-amend-unpushed-commit-7baa066cdb2d
- Author: @seungwoody
- Published: 2026-11-14
- Net votes: 0
- Tags: git, gitignore, git-amend

To remove a folder from git but keep it on disk, run git rm -r --cached <dir>, add the folder to .gitignore, then git commit --amend --no-edit. This rewrites the local commit so the files never reach the remote. It only works cleanly while the commit is unpushed; if it was already pushed, history must be rewritten (git filter-repo or BFG) and collaborators must be warned.
