Cleaning a build

Cleaning a build is about making sure you have gotten rid of everything that isn’t a source file and can have confidence that the build will be repeatable and not be impacted in unpredictable way by a stale file from a previous build.

  • Important not to delete source files.

There are different ways to do cleans - incremental cleans versus full clean. Incremental cleans are faster and usually not as thorough - there are tradeoffs here.

git clean -dfx

Is an extremely strong and simple way to clear out anything that isn’t a source file in a GIT repo - include files that you might have meant to be source files but forgot to commit to source control.