Sharing project with strangers and preparing for the worst...

Hello,

I would like to know what prevents a new addition to a team from just taking everything you created and starting his own project with that or just sharing/selling it to other people.

How do teams usually go about this?

Just don’t give whole project.
Ask your client work on an assets instead.
You are taking responsibility for an integration and full control over project.

And of course solid contract.

So you would limit yourself to sharing builds of the game before having a solid contract?

As far it is feasible yes.
A specially, if you don’t trust your coworker.
If other party does not require core game, to make changes, then is no need. For example making art and models.
But if you need make game levels as well, as need testing them, while developing, then you may have little to no choice. Unless you got tools, which limit needing for game core.