Skip to content

Forced repo cleanup

AlexeyBarabash edited this page Mar 10, 2025 · 1 revision

If you have an unexplained build error and you suspect the fresh repo clone would fix it, instead of doing the full clone, it's much faster to use git clean -ffdx command, suggested by @goodov:

git clean -ffdx will remove all deps and everything that's fetched via hooks. few important details:

  1. if you run it in src/brave, then it will also nuke .env, so make sure to restore it afterwards.
  2. if you run it in src/, then it will nuke src/brave.

so the full cleanup flow is something like this:

mv src/brave src_brave
git -C src clean -dffx
mv src_brave src/brave
git -C src/brave clean -dffx
# restore brave/.env
cd src/brave
npm run init
...

https://explainshell.com/explain?cmd=git+clean+-dffx why there's two f:

If an untracked directory is managed by a different git repository, it is not removed by default. Use -f option twice if you really want > to remove such a directory.

Clone this wiki locally