GIT – the great gap

Something I noticed when working in the software industry is that we have a lot (and more) tools where most people – including me – tend to only get the basic usage out of it but rarely dive deeper. When we then get into problems for one reason or the other, we have to resort to Stackoverflow, asking a colleague who knows better, etc.

Don’t get me wrong, that’s totally normal, we simply do not have the time or inclination to become experts everywhere and most of the time it’s wise to not invest time getting to the bottom of each topic when you will only need a few very basic use cases. But sometimes you will wish that you went all the way in, of course.

So, to me, it happens regularly that I – sometimes quite randomly – find a topic where I want to dive deeper and, having a week of vacation, it happened again, this time with GIT.

Before diving deeper, I would have described myself as a “normal user”, I could do the usual stuff, like commit, branches, even rebasing (with some vague feeling of uneasiness), but I was using mostly the gui provided by IntelliJ and didn’t really care what happens under the hood, what the files in the .git directory where actually containing, etc. This didn’t ever really hurt me in any way, but I hoped that gaining a bit more understanding might make me also a bit more confident in more difficult use cases – or even open up new possibilities.

So, since I already had the access, my first step was to check O’Reilly, where I had a recording around from July – Git Next Steps by Raju Ghandi, who explained very nicely about the file structure of git and how some of the underlying stuff works. Obviously, since this was a live online training of around 3 hours, it was pretty tight and while I learned a lot – thanks – I felt I lacked even a few basics, especially since I rarely use the command line for git, so I decided to take a step back and get a course on Udemy (somehow this seems to be my default fallback) and start basically from zero again. I chose “The Git & Github Bootcamp” simply because it had good reviews and the content seemed suitable, even if I would skip the Github content for now.

After going through the basics, I felt more confident – little but unsure about some details, but far deeper in git than ever before, at least (which is a low bar, admittedly). I also read “Rebase” by Pascal Precht, which had a nice first third about the data structure of git itself, pretty much similar to the content of Raju Ghandi’s talk, which helped a bit. Another short introduction can be found over at the “Missing Semester“, a collection of lectures about various tools used in CS, in this case, git, from MIT. The nice thing about a topic like git is, that you can quite easily experiment with the theoretical knowledge you gained by trying it out, so of course I also played around in various local git repositories – a lot.

Was it worth it? Well, I would say so, yes, even as my – a little bit naive – idea of using the command line much more in the future was pretty much utterly destroyed, because I realized that the command line is the weakest thing about git. Git itself is a very powerful tool and can be used in a lot of ways, but the commands feel like they were designed by dozens of people who all refused to talk to each other, leading to a less-than-great user experience, where commands, parameters, etc. feel pretty much lacking any consistent structure, with some commands doing far to much. This adds a layer of unnecessary complexity which makes it harder to understand git than it needs to be, because you can’t simply go through the commands one by one to understand it. A more clear, structure user interface would help a lot to make git easier to grok.

So, in the end, I’ll probably stay with the UI, with a little bit more confidence because I at least now have a more stable understanding of what’s happening under the hood. Of course, no doubt, Git is not a bad tool and I’m happy that I’m not using SVN (or even CVS, which my first company used) any more, but I will probably have a look at gitless in the future, which promises to add a layer of better command line tools over git while staying compatible with it.

To anyone who wants to go deeper, I really suggest starting with the basic data structure (see the Missing Semester above for a free introduction), which helps to get a basis for all the actual commands. This will, at least in my experience, help a lot to put all the actual commands in perspective and you will even be able to see what the tools are actually doing by checking the contents of the files in the .git directory directly.