Let's say a Git repository initially has either no license, or an extremely restrictive one, and then a more permissive license (such as the MIT License) is added in a later commit. Does this new license also apply to the history? If not, does this mean that anyone who clones, forks or distributes the repository is also bound by (and probably violates) copyright or license terms of the versions buried in the history?

What if the code with the "bad" license is in a different branch? What if that branch has been deleted, but not yet garbage collected, and is therefore still accessible?

  • 1
    "Let's say a Git repository..." - Do you mean GitHub? According to the GitHub Terms of Service, if you publish anything on GitHub, you implicitly at least allow people to "fork" (that is, copy into their repository) your repository. Redistribution outside of the GitHub service is not implicitly allowed, though. So for that you would need permission. Or equivalently go to the history version which has a LICENSE specified which gives you permission to do that. – Brandin Oct 31 at 5:59

Each commit in git history is a legally distinct entity, and is licensed according to the LICENSE file that existed at that point in history. As an author, you have the right to change the license of your project at any time.

So, if commit X switches the project's license from no-license to MIT, then any user has the right to use the project from point X forward under the MIT license; however, any commit older than X still remains unlicensed and cannot be used.

This remains true even if you decide later on to close the project again, say in commit Y. Then the code for commits X .. Y-1 will remain MIT-licensed, but the code from commit Y forward or before X is closed-source.

Now, having a "bad" license in the past is not really problematic -- as long as people who clone the project know not to use those past commits in any way. Something like looking into blame history qualifies as fair use; on the other hand, copying blocks of code from past commits might be problematic.

If you want to avoid these issues altogether and apply the new license retroactively, you can: (a) rewrite git history, and place your license-changing commit at the beginning of time; or (b) provide a written note somewhere in README that you wish the new license to apply retroactively to past commits. Note that in all cases you cannot revoke any past license, you can only grant an additional one (which is probably what you want anyway), making your code dual-licensed in the past.

  • A package which does not have a LICENSE file does not mean that it is "unlicensed" and even if it is somenow not "licensed" it definitely does not mean that it cannot be "used". Software copyright protects copying, not use. E.g. if there is some software installed on your computer (you didn't put it there), to use that means clicking on it, running it, etc. That is not copying. Of course, for software developers 'use' quite often means copying, modifying, compiling (which is a derivative work), and at some point probably redistribution, all of which require a license. – Brandin Oct 31 at 6:05
  • A LICENSE file is a common way to inform you of the license, but it is by no means the only way or possibly not even the most common way. For example, if you download something from a Web site, the author may have written on the page "I give you permission to ...". The ... is the license (what you are allowed to do). Other ways the author could have informed you of the license include source code comments, or in the README file, or even via a telephone call or SMS. You have to check, and many people don't. If it's unclear and you want to copy it, you could also just ask the author. – Brandin Oct 31 at 6:10
  • From the point of view of US law, code is property. It belongs to someone (the copyright owner), and this ownership can be either transferred or inherited. The owner also decides whether to allow other people to use his/her property and in what manner. Absent such permission, nobody other than the owner can use this property (barring fair use exceptions). But you're right that the permission doesn't have to come in the form of a LICENSE file, it's just the most simple and straightforward way. – Pasha Oct 31 at 19:56
  • @Brandin More specifically, 17 U.S.Code §106 grants a copyright owner an exclusive right to reproduce, prepare derivatives, and distribute the software. So if you have the software on your computer legally, you can "use" it, e.g. run the program. But without a license you don't have the permission to copy the program to your computer. – Pasha Oct 31 at 23:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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