what do y'all use for version control?

pert:
But for someone like you who is having trouble seeing the benefits of moving on from caveman-style version control, I think it would be a good path.

I do appreciate your suggestion (which is a sensible idea) but my problem is that I can't see any benefit in even that amount of effort when all my programming is for me on my own.

I guess I don't like the idea of getting drawn piecemeal into a "cult" that I don't understand.

Maybe another thing that "frightens me off" is the notion that I have to commit (pun intended) myself 100% to the system or it's not worth the effort.

And the piece of code that I suddenly realize I would like to go back to is the only one that I did not save (or commit) :slight_smile:

...R

jimLee:
Ok, since were on the subject.

What's the best way to set up repositories? Right now I have one big one basically everything Arduino. I'm wondering if the idea would work better if I had one per library folder that I own/manage?

-jim lee

It depends on what you are wanting to accomplish.

While you could put it all in one repo, my general rule of thumb is that if there are blobs or "entities" that are or could be separate components, then make them separate repositories.

Having them in one bundle can be convenient to grab everything at once, but having them separate, allows better source control of things like revisions. When they are separate you can track and create separate release tags for each component / library.

git is about versioning a directory tree or collection of files, not individual files. The issue you can run into if everything is one repo with something like libraries, is that you can not selectively checkout different versions of each individual library. You are stuck checking out the entire blob for a given point in time.

Even if they are separate repositories you could use submodules to create a wrapper repository that pulls in other repositories to create your desired directory structure.

And if you ever want to publish your Arduino libraries to be part of the Arduino IDE library manager or automatically pulled into platformio or libraries.io you will need to have each library in its own git repository.

I'm also a big believer and user of automation for doing builds and creating releases.
For example, for things like Arduino libraries, I use scripts that can pull revision tags from git and automatically update the library.properties file, header files, and documentation and recommit the files and re-tags them when I do a release.
It ensures that everything is consistent with the proper release information and makes doing releases really easy.

--- bill

Robin2:
I do appreciate your suggestion (which is a sensible idea) but my problem is that I can't see any benefit in even that amount of effort when all my programming is for me on my own.

This sounds more like you are not using or not wanting to use any source control vs not wanting to use git.
From a very high level git is really not that much different than other source control systems.

The benefit to using version control and having tools like diff and meld is that with with a command line or a GUI you can see what has changed or has been modified and potentially commit the changes or revert them.
Using a source control tool means you don't have to have multiple directories laying around for working on modifications or keeping old copies around that you can revert back to. That is all done by the tool.
And with tools like git you can push your updates to a git cloud service like github which helps protect you from losing the files should something happen to your machine or your backups.

Using source control tools can save time. It allows you to create a history of your changes and gives you the ability to checkout any version of the s/w you have committed.
It is part of a good development practice.
I can't imagine doing any s/w without having revision control and tools like diff and meld.

If you use the file manager plugins, it really is as simple as a few clicks to do things in a tool that you are more than likely already using, and the file manager colorizes and changes icons on the files to indicate their status.

--- bill

Ah. The MOOC that I had found useful was on Udacity (one of the free classes.)

Robin2:
I do appreciate your suggestion (which is a sensible idea) but my problem is that I can't see any benefit in even that amount of effort when all my programming is for me on my own.

If you install GitHub Desktop and start using it on one of your projects, the benefit you'll see immediately is commit messages. You make a change to your code and save the files. Then you commit those changes with a commit message that notes the reason for the change. It's so incredibly helpful to have that note to yourself for every change so you can look back through the commit history "Why did I do that? Oh, I see!".

You'll also get a very quick and convenient diff view of the changes in each commit. Sure, you can do that with your current system, but not in a way that allows you to quickly browse through the history of changes.

Those benefits easily make the minimal initial investment of time and energy to get started worthwhile. Over time, you'll decide it's worth making additional small investments to learn additional features as you need them, and these investments will also be worthwhile. There are features of Git that you'll have no interest in, so you simply don't waste time learning about those until such time as you might have a need for them.

Robin2:
I guess I don't like the idea of getting drawn piecemeal into a "cult" that I don't understand.

You already understand the need for versioning, otherwise you wouldn't have done the work to set up your current system. So the only thing you need to accept is that a formal system for doing version control might be better than the one only you are using. Then give it a chance. You can continue using your current system at the same time.

Cults prove that groups of people can be utterly wrong; but it's stupid people who participate in cults. Huge numbers of incredibly intelligent people are using Git and similar systems. Can you really believe they're all just drinking the koolaid?

pert:
Cults prove that groups of people can be utterly wrong; but it's stupid people who participate in cults. Huge numbers of incredibly intelligent people are using Git and similar systems. Can you really believe they're all just drinking the koolaid?

I didn't mean that the people using GIT are members of a cult. Merely that the concept of version control (and not just Git) seems to me as mysterious as a cult. I can see how it is probably essential when a group of people are working on the same project.

I get the feeling all the time that people are telling me all about the gear wheels in a clock without telling me about the clock :slight_smile:

And thank you for your input.

...R

Ok, lets see I have a few larger sketch projects, mp3 player & the cellPhone would be examples. And a bunch of other mess about sketches. Then, on the library scene, I have.. LC_baseTools as the foundation toolset for everything, LC_screen the foundation toolset for all drawing, and a bunch of other libraries for this and that general purpose functionality.

How would you set up repositories for a set like this?

-jim lee

A separate repository for each sketch and each library.

pert:
A separate repository for each sketch and each library.

I agree.
For my own Arduino stuff, I always create a "sketches" directory under my sketchbook directory where all the sketches are placed.
Then I create or clone each repository for a library into the "libraries" directory and for each sketch into the "sketches" directory.
If using a file manager addon, you can easily see what projects have uncommitted changes in them by simply going into
the libraries or sketches directory by looking at the icons for the directory/folder. Then go down into the desired one and you can see which files, then right click on the specific file and bring up a diff/meld that shows the specific changes in that file.

And if you don't already know, the Arduino IDE will locate sketch files no matter how deep under sub directories under the sketchbook directory. So you can organize your sketch repository tree any way you want and still use the IDE for builds.

--- bill

Here's my main screen that I work in on Eclipse (Oxygen.2 on Ubuntu 16 I like to stay a few versions old for stability). At the bottom are a bunch of tabs I use. Here I'm showing the Git Staging tab which shows what files have uncommitted changes.

This page is real nice because I can ignore any files or add them to the repo or all of that at the same time. Click and drag them down to staged area and hit Commit or Commit and Push(to send it to github).

It throws up this dialog to show what it did. And blammo.

CommitPush.png

I use github less to keep up with versions or share code with others. That's more of a side benefit. I mostly use it because I have different computers that I work with the same code from and as long as I'm disciplined about committing and pushing whenever I get done on one of them then the pull on the other computer is a simple "fast forward" and it all works out seamless.

The other screen that is cool is the Git Repositories pane. This is where you can check out a branch. Often I might want to work on something to do with the motors while I am at home and can test and then I might want to tweak on gui code or something on the laptop with just an Arduino and the LCD while I'm out on the road. So I can have multiple branches where I work on multiple things without breaking code on other parts. When something is complete and working I can merge it back into the master branch so it always has complete and working code.

And finally the coup de gras, the Git Reflog view.

Now when I code myself into a corner I can back up to a known point based on a known commit. I can even rebase and then merge the changes back in selectively except for the part I want to undo. And when I have to take a long few months break from the project I can come back and follow the commit messages and pick back up what I was working on. It's nice to have that, "oh yeah that's why I did that" moment.

CommitPush.png

To import a project back into Eclipse from Github

First I go to create a new arduino sketch like normal and give it the name I want. Then I right click and do Team -> Share Project. This takes you to a dialog to create a repo. Create an empty repo. I do it in the parent folder though it says not recommended but I do it so I can delete it with the project later. It's the one on github that matters to me.

Now I open up the .h and .cpp files and go to the Git Staging view. If you don't make an initial commit of these files you'll get an error later that you can't get out of. Right click and ignore everything but the .h and .cpp files and then move those two to Staged Changes.

And

Now right click the project in the Explorer and Team -> Remote -> Fetch From Put in the URI of the repo and everything and click Next.

Pick a ref (master was the only branch I have here) and click "Add All Branches Spec" to add all the branches. Finish

And OK

Now in in the repositories view we can see the c3c3357 Working commit from github in the Remote Tracking branches.

Double click it and check it out as a new local branch.

And

009.png

And now you have the project in the "remote" branch of your local repo. It might have errors because you need to import the libraries it uses into the new project.

Sometimes it throws weird errors and you have to delete them and hit compile to make it go away, but it's really just that easy.

Now make changes and commit and push back to the library.

Be sure to set it back to the master branch for the github repo

014.png

009.png

014.png

pert:
A separate repository for each sketch and each library.

69 sketch folders and 19 libraries.. 88 repositories?!? Yikes!

-jim lee

Wow, you've been busy! I see no problem in having lots of repositories. It's not as if you're getting charged for each one.

jimLee:
69 sketch folders and 19 libraries… 88 repositories?!? Yikes!

-jim lee

If some of the sketches are part of the same project you can put each of them in sub directories under a common project tree.
The project gets a repo vs having to have a separate repo for every single sketch.
I do this for many of my projects.

i.e. project is foo and foo has a repository
Under the foo directory you have:

foo/bar/bar.ino
foo/bar1/bar1.ino
foo/bar2/bar2.ino

etc…

— bill

And if some of the sketches are examples for a library then they will be part of the library repository and should not have their own repository.
--- bill

No.. The examples are in with the libraries as they should be.

Maybe I could do a folder of doodling sketches then let the bigger sketches have their own folders. I didn't know they could be nested.

-jim lee

I am surprised nobody has answered the original question even still: Subversion was definately way better to wrap my head around as long as nothing else requires something like Git. I may be late to the discussion, but that was the answer even in 2007!

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