We got into this subject in another thread, which I started out to reply in. But then my answer got a little long and I thought (hoped) this topic might spur additional discussion, so I decided to create a new thread. Also, I know it’s not directly related to openHAB but I feel it is tangentially related, so I hope the mods will indulge me. My hope is to increase understanding of Git (always a complicated topic) and thereby potentially “teach people how to fish” so to speak which will (hopefully) eventually increase participation and contributions.
Read the Pro Git book which is available free online (as in freedom, check the license). Although I encourage you to read on, as I plan to tell some tales (true ones!) and have a bit of fun along the way…
And so on with it
I was just about to ask, because if that’s the case then you probably don’t realize that those are even 3 different things. So that’s probably a good place to start.
Well, grab a cold beverage and pull up a chair.
Because Git (not unlike openHAB) is a pretty powerful tool, and like most powerful tools there will be some learning curve. However the payoff, IMO, is worth it.
I would also like to state at the outset that I am but a low level wizard myself, and I was able to figure it out, so you can too. But like all wizard skills, it does require spending some time at the podium(s) of the scrolls of ancient wisdom.
I think probably the hardest (conceptually) to get your head around is the underlying tool Git itself. But once you get that, everything else should fall into place.
First, a bit of History
None other than Linus Torvalds himself wrote Git because the version control (VC) software they were using at the time wasn’t cutting the mustard in developing the Linux kernel. So he wrote a new one from scratch in like 3 days(!). And it is an amazing piece of software, once you realize what it does. Because it is distributed version control. That means, that a whole bunch of different people, all over the world, can simultaneously work on a project together, and then merge all their changes back together into one. In fact, without Git I don’t think it is an exaggeration to say that Linux would probably never have become what it is today. It allowed first hundreds (and by now thousands) of hackers geographically dispersed all over the whole world to collaboratively work on a software project together. Well, that plus the Internet. But I digress…
I do think it is valuable however to understand the history, why something was created. The Wikipedia article on Git (that I linked to above) goes into some of those reasons, so I won’t duplicate that here. But I found it all quite fascinating. In fact there are a couple nice documentaries (available free online) that explain how all of this came to be, I could dig up the links if anyone is interested.
Hopefully understanding some of that background will whet your appetite to learn more. I know it did for me. Plus hearing about Git all the time. Well actually GitHub, where so many of these wonderful F/LOSS projects are hosted. It was only after researching that led me to the underlying Git.
Anyway, once I got to this point, I think the greatest help to me was reading the Pro Git book, which is available online and for free. It really explains the underlying concepts of Git and version control, and was the main way that I learned it.
Alongside reading the book, I did the exercises on a GNU/Linux machine which makes it very easy to learn (just
sudo apt install git). If you are on Windows I am not sure what to tell you (switch to Linux ). Another tip: there are all these tools and GUIs that are supposed to make it “easier” but IMO all they do is obscure the underlying command line, which are really simple and easy actually (once you begin to get your head around the underlying concepts in the book).
Finally, I will just state again that Git is a very powerful tool. And that I am by no means an expert. I probably only understand maybe 5-10% of it. But that is enough to use it. The basic commands that you will use all the time are only a few:
git commit git pull git push git clone git merge
There are tons more of course but those are for much higher level wizards that use it every day. You do not need almost any of those advanced commands in every day practice.
Just understand that GitHub is a website that hosts Git instances (called Repositories) along with some other nicely related features like forums, bug trackers, etc. for free (community projects) or paid (businesses / with support contract, etc.). But you don’t have to use GitHub to use Git. For example, for your own personal stuff that you don’t want to share with the world. I think not enough people understand this. If you are already running GNU/Linux on some Single Board Computer (as many of us are with openHAB already) then you can self host your own repositories. Which is super neat and is what I do for lots of (text based) things like my own personal/private text based accounting (using Beancount) data, Orgmode notes, dot files, etc…
Once you understand the command line Git tools, structure of repositories, etc. it will become immediately apparent their GitHub counterparts.
And finally there is…
openHAB GitHub Policies
Most projects (including openHAB) have a particular workflow, coding style, etc. In the case of openHAB, a stepping stone into these guidelines can be found here.
And Finally, to actually Answer Your Question
I guess I cannot directly answer a step by step, because without the underlying knowledge of each of the above big moving parts, and how they work together, I don’t think you will be successful in using them. Because at the intersection of multiple complicated tools, there is no “one size fits all” answer. And this way you will be much better prepared to contribute to other projects in the future also.
But I have faith in someone who has successfully integrated openHAB to be able to get their head around it. You do have to take a step back though and eat the elephant one bite at a time so to speak. Don’t try and do it when you are in a hurry or need to contribute something “right now.” Or when the wife and kids are nagging you. Take a separate day (or few days, right now over holiday break is a perfect time) and grab a cold tasty delicious (adult?) beverage of your choosing, sit down at your favorite computer area, open the Git Pro book in one window and a terminal in the other, and start learning the basics.
I will back up actually. If I recall correctly, I think I had to take a couple (few?) different stabs at reading the book before the concepts started to sink in. Only then (when things started to “gel”) did I get all excited about it and it was then that I sat down at the terminal and everything has just flowed from there ever since.
Let me know if you (or anyone else) have any particular sticking points, conceptually or otherwise, and I will be happy to try and help, just as I have received so much help through these very forums.