Vlambeer had a GDC talk about streaming development of their game Nuclear Throne that you can watch on youtube. They streamed some parts of the game that an audience would find interesting. Give it a watch it answers a lot of your questions.
As far an I know they have not had any issues with people stealing their game. They still have the IP of their game and don't have issues.
If someone "stole their code" they would only have small fragments which they could use but what are they really going to do with one class without all the other classes that are needed to make that class work? Without a large chunk of the code or the code for a module you couldn't really make a direct copy it.
As for open source games like Simutrans and OpenTTD they have an open licence so you can use it for whatever you like. The catch is that they still have the Trademark of the game so you can copy and paste the code and change a line of code and sell it but that most likely won't hold up in court under copyright law.
Hope this helps
*I'm not a lawyer.