Projects Version Control

I was listening to The Amp Hour podcast yesterday and the talk was all about hardware revision control from a startup called AllSpice. This got me thinking about all my own projects and how i have them not stored in an efficient and meaningful way.

Currently stuff is all over the place, firmware in one place, ecad in another, datasheets in yet another and other documents strewn all around my documents folder and the internet. My plan here is to bring all the relevant bits together into one place for each individual project.

Each project now has its own directory with the following directory structure. The picture below is for the 50w antenna tuner project. Its the only one i have sorted out enough to have all its bits in one place HEHE.

The Arduino folder contains the firmware for this project, the datasheets folder contains just one datasheet, the one for the relays I used. The point here is to have the datasheet for any new parts that I am using on hand with the project to ensure i do not make footprint mistakes. The documents folder is so i can make notes and will contain files i might have found on the internet etc that inspired the project. The other 3 are just to keep the ecad files all nice and tidy.

So with the directory structure under control and able to suit my needs, the next thing was setting up GIT. Ok, I am not a GIT fanboy, the last time I used a repository in anger was many years ago when i was a programmer for a free online game and then the main game in town was Subversion. Off to learn GIT we go.

This is where things start to become less helpful for you the reader because i am going to gloss over a lot of things here, because so much of this is specific to you, your operating system and who is hosting your git repos.

First thing i did was download and install GIT for windows. Next thing I did was install and configure GIT on my server and setup the repo. I am self hosted and have control over the entire machine, so not much I can tell you what to do here. But for most of you, it would be setup your account on github and make your first repo.

The rest of this is the easy part, on your local machine setup the folder structure you are going to use, put some files in there and open up git. I used git bash because i prefer the unix like command line.

Navigate to the location where your files are located, you can see above for me where things are located. Next we start making git commands.

First initialize the git repo.

Next we add all the files we just moved in there to our repo. I always cheat here and just use the * wildcard to add everything.

Then we commit the changes we have made to the repo. The comments in quotation marks are so you know what you have changed since the last time you committed changes to the repo. Make them as descriptive as you require.

Next we setup an origin, this is more or less just a shortcut to the remote server so you do not have to type out all the time. It just makes things simple and easy.Just use the url to your repo supplied by github here is that is where you are hosting.

Finally we push our changes to the remote servers master branch of our repository. We are then done. From here on out its just a matter of following steps 2 to 5 each time you either make changes or add new files to the repo. I am only using 1 repo for all my various projects and having them hanging off a single directory, but you might like to have separate repos for all your projects.

Depending on how you have your git repos setup, you might also have to use your username and password when pushing changes to the remote server. I have mine setup so only a single user can read and write to the git repository rather than being public.

So that is about it, now i have the unenviable job of spending a bunch of time sorting out my project files into some kind of sanity and then sticking to the system. HAHAHA wish me luck.


2 thoughts on “Projects Version Control

  1. I fight with this constantly. Some apps (like you, ltspice) just aren’t great at version control. So I end up with endless folder trees “rev A” “rev B C D E”. Start to lose track of what I did when. Tedious to keep it all straight. And of course, much later you figure out a much more efficient method, but converting everything over would take days….

    1. HAHAHA yeah that is about the sum of it Tom. I have not moved everything over yet, just the bits that I have been working on. But it has proven handy to have all the filed related to one project in one place. Its one of the better ideas that I have had. I am not sure GIT is really the right tool for the job, but it works.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.