Don't make www-data owner of the code files at all. If you own the files, then you can change their permissions into something writeable for you.
Give r/w rights to your user and r only (and of course x for directories) for the group. Then make the group of the code www-data.