So, I contribute to a few projects, but the code I contribute is from ideas for my own projects.
So let's say I have Project A, and a competitor has Project B. I contribute code I wrote to Project B, and they accept my code. Then, later, using the same code that I wrote, I release Project A as a direct competitor to Project B. However, both projects use the same code, which was originally written by me.
Legally, who owns the contributed code, and could Project B file a DMCA request on Project A, because the code was first seen in Project B?
Edit: I don't think I was clear enough. I write code for Project B first, with intention of using code in Project A later.