Best practices for version control across different schematics

I've built versions 1.0 of my device. PCB and code fully working in production. Now I want to upgrade the device and add new capability and peripherals, let's call this V2.0. Of course the new device will have much of the same code as the old one but with more functions and libraries, but more importantly it will probably add new pin assignments and change some of the old ones...
I was wondering about the best practice for managing the different code versions for the old and new device. I was thinking one of two approaches:

  1. I can keep everything in the same repo and create a fork where all the changes for the new device. Those forks will probably never merge unless there's a critical fix that applies to both.

  2. I can start with a copy of the V1.0 code and create a new repo to start tracking version history for the V2.0 device. In the event I have a fix that needs to apply to the old device code, I can just manually apply it.

I don't know if there is a third approach. Any advice will greatly help.

Thanks.

  1. Create a tag V1 and continue working on the next version.

  2. Create a branch V1 if you intend to improve the old version later. Then create a branch V2 and make it the new master.

3 Likes

This is the best process. No need to fork the repo, just tag everything in V1 and continue on. An alternative would be to create a V1 branch in case you expect to have to make changes to V1 that won't be in V2, but generally it's best to not have to support multiple versions of the same thing if you can avoid it.

4 Likes

I’ll add one more thing - issue a release for V1 and give a link to it in the documentation. This will make it easy to download the old version package even for those users who do not know Git very well.

3 Likes

Thanks. How would you manage libraries in this case. I'm using Arduino Studio. what would the IDE keep the versions of the libraries I'm using in V1 if I update the libraries for use in V2?

You leave V1 untouched, unless you have a compelling reason for also using the new library in V1.

You can try to detach the library and define a common interface (API, header...) for it. Then use the interface in your code and link finally to the desired library.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.