I have a piece of code of my own that I want to use in a company that I'm working on. How can I protect it from being owned by the company?

I'm not going to make it public yet, so is it a good idea to upload it to github with a GPL licence in a private repo so I have proof of it being developed before I started working with it in the company? and being GPLed I protect it from being included without my consent on future project in the company?

also, can I re-licence it to the company to let them use in the future or to get paid to?

1 Answer 1


I will assume that you have developed this code de novo, and thus are the sole rightsholder in it.

Licences do not inhere in software, they attach to the recipients through the act of conveyance. So if you upload it to a repo that nobody can see or access, saying that you are doing so "with a GPL licence" is fairly meaningless. The important bit of this plan isn't the licence, it's the third-party date stamp, which could be used later to prove you'd written the code before you started working for the company in question.

Unfortunately, depending on your jurisdiction, the nature of your relationship to this company, and the details of your contract with them, this may not help. In most jurisdictions there is the concept of work-for-hire. This may or may not have the effect of giving the rights in your pre-existing code to the company; but if you work on it as part of your involvement with the company the codebase may end up hopelessly rights-encumbered, and be effectively unusable by you afterwards. In some employment contracts things are even worse, and the company becomes the rightsholder in anything you do while an employee, creating the above problem, in spades.

In short, the problem as I see it is not proving that you were sole rightsholder in this code before you started working for the company, it's proving that you're still the sole rightsholder after you've worked on it for them. We do have some questions here that address this, but it comes down to being contractually explicit about what rights in the codebase you are transferring to the company, and what rights you reserve. If you duck this question now, don't assume that you can pull a big reveal later, expose the earlier repo, and the company will just shrug and walk away. And, of course, IANAL/IANYL.

  • in this case I worked in my code before entering the company (I didnt enter yet) so timesamp is required to show that. and with the license I wanted to be sure that I can include my work into the company codebase and still be able to make improvements on my code being opensource... may be GPL is not the right choice
    – BagOfWords
    May 13, 2021 at 23:20
  • 1
    @Nicolas let me repeat, in case I haven't been clear: IMO, the issue isn't the licence, it's the rights ownership. You need to explicitly address this in your agreement with the company.
    – MadHatter
    May 14, 2021 at 5:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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