I have previously written a lot of code that is hosted on a public repo on GitHub, but it never had a license. It was written as part of my work while working for a non-commercial academic entity, and I would like to add a license before the link to the repo will be included in something that will be made public, potentially attracting one or two visitors.

This leaves me with a couple of questions:

  1. Can I just add a license after the fact and it will be valid for all prior work?
  2. Do I have to make sure the license is included in all branches of the repo, or does this not matter? There are for instance a couple of branches that are used to freeze the state of code at a certain time for reproducibility’s sake (I know this could be solved in a better way, but that’s how it is).
  3. I have myself reused some of the code in my current work for a commercial entity (internal analysis work, only distributed within the organization). Should this influence the type of license I choose? I am considering a GPL-license, but should I go with (what I believe to be) a more permissive license like MIT because of this?
  • kevincoxM
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago
    1. Can I just add a license after the fact and it will be valid for all prior work?

    This is fun question because it hinges on a silly technicality of software development. If you add a license to your repo today, the license applies to the code as of that point in the commit history.

    I think you are getting a bit too caught up at the process of adding a LICENCE file to a repo. This is just one way to licence some work. You can just say “I as the copyright owner of this work licence it, including all previous revisions under licence X”. That is also licensing the code and doesn’t matter if the LICENCE file exists at any particular commit.

    But yes, I would say that by default adding a LICENCE file would be interpreted just as releasing that version of the code under the particular licence.

    • Daniel Quinn@lemmy.ca
      link
      fedilink
      English
      arrow-up
      2
      ·
      9 months ago

      That’s fair, though if you’re looking for something more legally ironclad, I’m not sure I would want to depend on a declaration like that. But you’re right, as the sole copyright holder, you can choose to apply your licence any way you like, so long as it’s clear (for some value of clear) to the recipient that the software, what the license is.