`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.
More on Lost Work, HEAD and History Problems
`fatal: Unable to create '/repo/.git/index.lock': File exists.`BeginnerYou added a file to `.gitignore`, but `git status` still shows it as modified.Beginner`fatal: your current branch 'main' does not have any commits yet`Beginner`Author identity unknown *** Please tell me who you are.` and `fatal: unable to auto-detect email address`Beginner`fatal: ambiguous argument 'HEAD~1': unknown revision or path not in the working tree.`BeginnerYour commits do not show on your GitHub profile contribution graph.Intermediate