Git setup for building a commercial product on an OSS project

Projects like Simple IoT and Yoe are designed to be used as the foundation for building commercial products. So, how can we set up Git workspaces to maintain the product over time AND contribute improvements to the OSS project? The following is one way:

I use ssh Git URLs for all repos I want to push to, and HTTP URLs for repos that are pull only. Even if I have write access to the Upstream OSS repo, I connect from the product workspace with an HTTP URL which ensures I never accidentally push changes from the Project workspace to the OSS repo.

The upstream repo is routinely merged into the product workspace. This pulls in the latest improvements, plus allows us to keep synchronized so that we can easily contribute improvements back to the OSS project.

To contribute changes back to the OSS repo, a new branch is created in the OSS workspace and commits are cherry-picked from the project repo. Alternatively, an entire product repo branch can be merged into the OSS workspace branch if we are sure it contains only OSS commits. This branch is pushed to PR, reviewed, and then integrated into the OSS repo.

For this to work well, you need to:

  • clearly differentiate what is product and OSS work
  • keep your commits and PRs granular – especially in the product repo so you can easily cherry-pick them into the OSS repo as needed.

With SimpleIoT it is also possible to embed SIOT as a Go package in a larger application.

With a little thought, it is easy to build products on top of OSS projects, keep changes flowing in both directions and minimize mistakes.

2 Likes