Background: I'm working on a Formula Student Team (we develop and build a race car each year) and until now we did not have any kind of version control. From now on, we will use GitHub to manage our projects. The projects are in constant evolution, so even though the car is running with some version of the PCBs and software, they both keep evolving.
Setup: We have one repository for all the different projects (dashboard, data aquisition, BMS, safety circuits & logic PCBs...). As of now, we stored the current version of each project that makes the car work, along with some common libraries and documentation.
Question: How can we define the concept of release? In other words, how to manage all the projects knowing that they do not evolve at the same rate?
Keep in mind that everything is constantly under development, so maybe a new version of the BMS comes in March and a new version of the dashboard comes in September, but the competitions are in July-August, so the car we compete with might have or not the projects developed that year.
The solution that came to my mind was the following: Use a release branch for each project. Making it a protected branch, and merging them to the main branch prior to the competitions to have a record of which version of every project was in the car for the competitions, with a "safe version" for each one.
I don't feel like that is a good idea because I had never used version control for something this big before, and I want to make the best possible decision in this aspect for the team, as the repository is meant to be something atemporal and a bad decision could cause a lot of harm in the coming years.
Thank you very much in advance!
CodePudding user response:
Your problem could be solved using git's submodule
feature.
https://git-scm.com/book/en/v2/Git-Tools-Submodules
create a new empty repository
mkdir reslease_repo
git init reslease_repo
change into this new repo and checkout the other repos each in a separate subdier to reslease_repo
cd reslease_repo
git clone [url-of-first-module] first-module
git clone [url-of-second-module] second-module
# ...
Go into each submodule and checkout the commit that should be part of the delivery
cd first-module
git checkout [branch|tag|commit-id]
Then go back to reslease_repo and add the modules directory
cd ..
git submodule add [url-of-first-module] first-module
Repeat that for all modules.
The content of the modules will not be checked in into the reslease_repo
.
When cloning reslease_repo
add the git parameter --recurse-submodules
to fetch their content along with the main repo.