Interview Prep/Git & GitHub/Lost Work, HEAD and History Problems

`warning: unable to rmdir 'build': Directory not empty` after switching branches.

BeginnerTroubleshootingLost Work, HEAD and History Problems
Answer

Likely causes → The directory still contains untracked or ignored files (build output, caches), so Git removed only the tracked ones.

Diagnose → git status --ignored and ls -la build.

Fix → The warning is harmless. Remove the leftovers if unwanted: git clean -fdX build/ (ignored only; preview with -n).

Prevent → Keep build output outside the source tree or in clearly ignored paths.

All Git & GitHub questions Roadmap: Git & GitHub

More on Lost Work, HEAD and History Problems