I have a repo in GitHub which contains many different projects, each in its own folder and right now the license for this repo is Apache License 2.0.

Now I want to add another project to this repo, which is based on a code samples from a project under Mozilla Public License 2.0, and according to this license, I must use the same license file if I borrow from the source which is under this license.

If I put the MPL-2.0 license file in the folder which contains my new project, will it be right(license wise)? although the main repo will be still under Apache-2.0 license.

Will such structure make sense?

├── project-1
├── project-2
├── project-3
├── project-4
├── project-5
|   └── MPL-2.0-license-file
├── Apache-2.0-license-file
  • 1
    What about the source code files within those project-X directories? Do they have a header/copyright notice that specifies the license?
    – Brandin
    Commented Aug 31, 2022 at 8:37
  • @Brandin they don't there's only one license file in the main directory Commented Sep 1, 2022 at 6:53
  • 1
    It's not required to do so, of course, but it may also be a good idea to consider, e.g. "/* Copyright 2022 Max Mustermann. Distributed under XYZ license; see LICENSE file. */" For open source this may make some uses easier for others, e.g. what if I fork your code and want to add my own changes to this file? The header makes it obvious to do that (e.g. I can add my own notice in that file and leave yours there, and for licenses that require such a declaration, I can state there what changes I made versus the original).
    – Brandin
    Commented Sep 1, 2022 at 7:11

1 Answer 1


That's a perfectly suitable solution. To be on the safe side, I'd add a note in the main license file saying something like "This license applies to the entire repo except for subfolders that have their own license file. In such cases, the license file in the subfolder takes precedence."

  • Please forgive the tiny fix-up edit!
    – MadHatter
    Commented Aug 31, 2022 at 9:00
  • @MadHatter nothing to forgive - thanks for fixing that!
    – Mureinik
    Commented Aug 31, 2022 at 10:14

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.