I have a Git repository with a medium-sized project on GitHub. Since there are some components depending on GPL libraries, the repository is currently also licensed under the GPL. However, the GPL-licensed library is only used by some components (which can be isolated), and the remainder of the project is perfectly usable without those components. Therefore, I want to license everything that has no dependencies on any GPL libraries under the MIT license. What are the best practices to achieve this?
My idea is to have two different branches: one branch contains the full code and is licensed under GPL. The other branch removes all functionality that depends on GPL code and is licensed under the MIT. Is it feasible and/or common to have different licenses for different branches of the same repository? If not, what would be better alternatives?
Could it be a problem that, technically, the full history of that new non-GPL-branch once included GPL-code? Or is it fine as long as all GPL-code is removed from that branch before I add the new MIT license file on the branch?
Note that this question is somewhat similar, but I have the feeling that mine is more concerned with the technical implementation. That is, can I simply put two different LICENSE files in the root directory of the repository, depending on which branch we are currently on?