I have a private repository. I was using MIT license. But now I want to change it to GPL3 before making it public. The problem is that if I change the license in a commit and push it, technically, you are allowed to use a previous commit according to MIT license (which I don't want).

Is there a way to change the license in all of the previous commits? I heard about doing it individually for each commit in git rebase but there needs to be a better way!

2 Answers

melpomene On Best Solutions

If all you want to change is a single file, do that and commit it.

Then you can use git rebase -i to rearrange commits. In particular, you can move the change to the license file to the beginning of history, as if it had always been there.

Markus W Mahlberg On

You can not retroactively change a contract, as per principle of legal certainty. So the people who downloaded and use your software under MIT license can in no way be forced to cease usage of your software under the terms of MIT license up to the revision in which you changed to GPL

To prevent further clone your software under the MIT license, I would set up a new repo and use the current state as the initial commit, while deleting the old repo.

On the other hand - who would want to have an older version of the code, really? Personally, I would simply change the license, add the new header to the files and every user of the current version would have to use it under GPL.

IANAL, but depending on the kind of software we are talking about, especially if it is a server of any kind, it could make sense to change to the AGPL.