What is the best practice for pushing clean code to the main branch?
This is a best practice question about Mercurial, however the thoughts of other DVCS/git users would also be applicable. If there is a suitable website please point me to it.
How do large projects with lots of contributers keep the main development branch clean?
I pull a copy of the source from the central repository and then make a bunch of local changes using branches, tags, local merges of experimental code and commits until everything is tested and works.
Now I make the final commit and push my changes back up to the trunk - this will send the full history of my local changes to the central server.
This is conceptually fine, however that means that the supervisor who performs the final build gets to see all my experimental and buggy code working towards the final tested version.
Is there a best practice way to slim down my push so that it only contains clean code? Is it my reposonsibility to clean my code (with collapse or other extensions), or does the supervisor select the clean bits and copy them to a 'final release' repository?
your help is much appreciated,
Steve
=======================
Answer: I have accepted Tims answer below and the link he has given about github in particular [ github.com/git/git/blob/master/Documentation/SubmittingPatches ]. So yes - clean up your submission before pushing it to the central repository!