Developing an Arduino library under git control?

Short form: What do the cool kids do when developing an Arduino library under git control?

Assume I'm creating an Arduino library, and I'd like to maintain it under git along the way, ending up with something clean and elegant like this one. What's the preferred work flow?

As it is now, I edit my library files in Documents\Arduino\libraries<my library>\ and then copy them to my git repository after I've made changes -- that's somewhat awkward. I'm sure there's a better way, and to repeat myself: what do the cool kids do for this?

Why not just put the repository at Documents\Arduino\libraries\<my library>?

(edited): I thought of that, but: if there's an examples/ directory in the repo, does Arduino know to look there for the examples?

It depends on Your environment. My know-how for the problem You described is restricted to my environment, which is Eclipse/Sloeber and Linux.
And I have several libraries which are not specific to Arduino (state machine, ring buffer, math procedures, tools for this and that) and which I use also for other projects (e.g. C++ graphical applications with GTK+/gtkmm).

My solution is a GIT repository organized to my personal needs. The files from this repository are then linked (Linux links, do not compare with Windows links) into my Eclipse projects (Arduino and others).
So for all of my libraries I have only one source environment (that GIT repository) but many different projects. If I find an error or have an improvement in one project, all other projects will use the new version automatically.

P.S.: It is not the link provided by the IDE, which has other path dependencies. It is the fundamental file link of Linux, which has the same behavior as a real copy of the file. You can do such things also with Windows, but not from the graphical explorer environment. You must use the terminal (cmd.exe) and make the link via command line. It does not work with FAT (USB-Sticks) but with NTFS.

the folder structure of the repository must be the same as in the libraries folder if you want to publish the library to Library Manager

@profrob You are clearly one of the cool kids, but as you might have guessed from the backslashed pathname in the original note (Documents\Arduino\libraries\<my library>\ ) I'm on a Windows system. So linking isn't an options.

But my follow-on question applies: if there's an examples/ subdirectory, does Arduino know how to follow that? And ditto for a src/ subdirectory: does Arduino know to look for the .cpp and .h files there?

@Juraj That sounds hopeful. Ideally, the repository IS the libraries folder, so the structure is guaranteed to be the same.

Where can I learn more about the required structure of the libraries folder?

no. have a separate repository for each library

Thanks - the library-specification tells me exactly what I needed.

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