I don’t use XCode for building; instead, I use the CLI, and you can pass this flag to clean your project.
Engine/Build/BatchFiles/RunUAT.command BuildEditor -clean
and if you want to learn more about different flags, this is a good resource:
And in case it’s helpful to anybody here is a breakdown of the repo size: