12

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.

MadHatter
  • 48,547
  • 4
  • 122
  • 166
  • 3
    I've tidied up your question a little to remove references to pull requests, as the copyright status of your contribution is not a function of how you contributed, and the question is more generally-useful when it's not couched in git-specific language. However, if you don't like the changes, feel free to roll them back. And welcome to OS.SE! – MadHatter Jun 01 '20 at 07:11
  • 3
    This is a legal question. Did you ask your lawyer? The answer could depend upon your legal system, your work contract, etc... and is country specific: details are different in France, in India and in the USA – Basile Starynkevitch Jun 02 '20 at 06:06
  • 2
    @BasileStarynkevitch nearly all questions here are legal ones, at least in part, and therefore have contractual / jurisdictional aspects. I'm not sure it's worth posting such a note below every question, though do by all means add such a caveat to your own answers. – MadHatter Jun 02 '20 at 06:49
  • What are the respective licenses of project A and project B? Are they both open source licenses or not? – Brandin Jun 05 '20 at 10:41

1 Answers1

21

You own any code that you write. When you contribute to projects you aren't handing over your copyright (ownership), you're giving them a license to your work. It's usually inferred to be the same license as what's in the project.

If you contribute to project B, you own the code, and gave Project B a license to that code.

Nothing prevents you from putting that code in Project A, no need to attribute or include the license from the other project because you are the copyright holder.

Seth Falco
  • 499
  • 2
  • 11
  • 16
    There are potential complications, such as if Project B had a Contributor Licensing Agreement that forbade such reuse, or indeed a Copyright Transfer Agreement, whether in either case a click-through (possible problems) or an explicit (definite problems) agreement. But absent any such, I agree with Seth. – MadHatter Jun 01 '20 at 07:08
  • 1
    @MadHatter I imagine that when one does git push one usually doesn't send a license (unless they edited it). I wonder how that "giving them a license" works. I.e. how git pushing to a repo that has a license implies you're offering your code under the same license. Regarding the agreements mentioned by you, would the mere presence of any agreement in the repo also mean you agree to them when you git push to the repo? – JoL Jun 01 '20 at 17:07
  • 1
    @JoL Yeah, if the repository that you downloaded has a LICENSE and you make changes and either push or open a PR, then it's very reasonable to assume that (unless you made some statement in your PR like "this code is under License X", in which case they should probably just reject your contribution) you're licensing the code under the terms of the license of the project. – Greg Schmit Jun 01 '20 at 20:00
  • 3
    And at least in git, your commit is a snapshot (not a diff) which includes the LICENSE file, so you are, in a way, explicitly licensing your contributions. – Greg Schmit Jun 01 '20 at 20:01
  • 4
    @JoL This isn't universal, but many projects require you to, separately and explicitly, accept a formal Contributor License Agreement before they will accept your code into the project. – Douglas Jun 02 '20 at 04:57
  • @JoL "I wonder how that "giving them a license" works" I didn't write it, so I can't comment. I agree that licence out = licence in is a community norm, but it's only legally binding with certain licences. We discuss the whole issue of CLA/CTAs, including click-through and other implicit licences, and there is far from general agreement that they are binding. Get written (electronic will do) licence agreements from contributors, if you want to keep your house maximally in order. – MadHatter Jun 02 '20 at 06:46
  • 1
    The other big complication is contributions made in the course of employment. In which case the copyright is usually owned by the employer. – user1937198 Jun 02 '20 at 09:39
  • I apologize if this is off-topic: in most US states, doesn't your employer own code you write, due to the Uniform Trade Secrets Act? My understanding is that the state laws are worded such that most source code is considered a "trade secret", with no exemption for code written on your own time. I'm not a lawyer; just seeking to improve my own understanding. – John Walthour Jun 02 '20 at 12:21
  • 1
    @JohnWalthour Someone can correct me if I'm wrong, but I believe you're correct. Intellectual property that is made under a work for hire relationship usually implies the transfer of copyright to the paying party. It's always better to have a written license/transfer agreement, though. In the UK the implied license can even be argued when "circumstances suggest that the copyright owner expected the user to make use of the copyright material in the way they intend" https://www.gov.uk/guidance/license-sell-or-market-your-copyright-material#license-your-copyright#implied-licence – Seth Falco Jun 02 '20 at 12:29