How are the code bases organized in GitHub

Forum: PC programming Version management: how to organize a project?

Meal, I'm working on a medium sized uC project at home. The function of my device is relatively trivial, a typical hobbyist's watch with a few fun features. However, a lot of different controller hardware is required, in the game are ADC, UART, DCF77, Spi, shift registers, etc. That's why I didn't just hack it in dirty but built it cleanly modular, created nice interfaces and made sure that the code was reusable. Now I have a nice code base that I can use for future projects. I also solved the whole thing with git as version management, so I could work on different modules at the same time as I wanted by simply switching the branch. When a module or feature was finished, I merged it into the main branch. This means that all of my modules have a clean version history. The .git folder is located in the root folder of my project. So now my problem. I would like to add a feature to my device. The module will be quite extensive, perhaps even the largest of the previous software. Basically, it could almost pass as an independent project. When it is finished I would like to publish it as OpenSource, as it may be useful for one or the other and is not specially tailored to my project. Accordingly, my first thought would be to create my own project with its own git repository. However, this module needs a software environment in which it can run, otherwise it doesn't make sense (similar to a FAT library, which is actually of little use on its own). My watch would be a good choice. But then I spontaneously don't know how to get a separate project history. When I upload my repository to github or something similar later, I don't want my clock code in there because nobody will be interested in it. That also speaks for a separate project, enriched with up to test code around it, which uses the module. What speaks against it: the project will probably drag on, and I might want to use part of this planned feature in my watch. Therefore, it would make sense to develop the module in the previous git project after all. So, stand up to the hose. How would you organize this project? - Copy your own project and working partial statuses into the clock? - develop directly in the watch project? Greetings!

Shot from the hip, I would say: Make a new project in which you add your "clock code" as a "submodule". But I'm not the Git expert either, but should be possible in one way or another.

instruct your build environment to build the submodule from clock /../ other module or use symlink in clock: other module -> ../other module or gitignore to ignore other module, simply develop another module below clock

You can do that with git submodules. Your clock project remains as it is. Create a new git project for your new module. Then you can, for example, add the new module as a sub-module to the clock or vice versa. Whichever makes more sense. If you want to publish your module one way or another, do it now. So everyone can look into your code and help you. The sooner the better. There are experts here for C, C ++, Python, Makefiles, etc. One or the other might want to join in and so you can concentrate on your code, for example, while another is ironing out bugs or working on Makefiles, or or ... How it would be with or Both of them allow you to host opensource projects. At bitbucket there are also a handful of private individuals.

Eduard Scheske wrote:> You can do that with git submodules.> Http:// Thank you. One more question: the module, or "submodule" in git jargon, should also be able to be tested independently. Accordingly, the sub-project must bring its own main.c and up to 1 craft code. These would then end up in the "big" project. In terms of build, this probably doesn't cause any problems, because the makefile of the super project ignores unnecessary files. But it would be nice if the submodule really only brings the bare essentials, i.e. a submodul.h and a submodul.c. Otherwise unnecessary files would clutter the super project. Can that be handled somehow?

Write an answer

Providing an email address is voluntary. If you would like to be automatically informed by e-mail about replies to your post, please register.

Important rules - read first, then post!

  • Use upper and lower case
  • Do not insert longer source code in the text, but as a file attachment

Formatting (more information ...)

  • [c] C code [/ c]
  • [code] code in other languages, ASCII drawings [/ code]
  • [math] Formula in LaTeX syntax [/ math]
  • [[Title]] - Link to article
  • Insert reference to another post: right click on post title,
    "Copy address" and paste it into the text