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.

  • 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
    Commented Jun 1, 2020 at 7: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 Commented Jun 2, 2020 at 6: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
    Commented Jun 2, 2020 at 6:49
  • What are the respective licenses of project A and project B? Are they both open source licenses or not?
    – Brandin
    Commented Jun 5, 2020 at 10:41

1 Answer 1


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.

  • 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
    Commented Jun 1, 2020 at 7: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
    Commented Jun 1, 2020 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. Commented Jun 1, 2020 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. Commented Jun 1, 2020 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
    Commented Jun 2, 2020 at 4:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.