When I started working in sysadmin/ops land, I knew that version control would be important, and knew a little bit about it. I had used Git in a very basic way while playing around with some amateur coding projects. I knew how to initialize a repo, see which files were tracked, and stage and commit changes. But I didn’t quite appreciate how crucial a thorough understanding of Git would be to really be effective in maintaining and deploying code in a systems context – with thousands of users depending on availability of a server that needs to be patched, updated, etc safely, securely, and on-schedule. It didn’t take long before I was dedicating as much time as possible to mastering Git. I even created a “Git” section on my OneNote notebook, which is a big deal if you know me.
I knew I needed to learn a lot in a hurry. Thankfully, not only is Git Open Source software with thorough documentation – there is a real open community around git. A great example of this is the Pro Git textbook. This is a fantastic OER (open education resource). The book can be viewed online or downloaded in an ebook format for free. In my case, I downloaded the .mobi Kindle format and used the “Send to Kindle” option to add the ebook to my Kindle library. This allowed me to read the book with variable fonts and text sizes, and to highlight and make notes. There are also tons of good forum spaces for discussing git and asking questions (or more likely finding an answer that has already been given), from Stack Overflow forums specifically for GitHub.
Another virtue of git is that by its nature, it allows you to experiment and play. I cloned a repo of my institution’s production Moodle code into my own safe practice space, knowing that I could try things out and was perfectly safe as long as I didn’t push any commits back. And even if I did somehow end up with bad code, you can always reset back to a working commit. This allowed me to work on git skills and have a Moodle directory to explore and mess-up in a consequence free environment.
The git skills I’ve built have already paid off – aside from being crucial to any sane workflow for updating Moodle or WordPress sites, git has already saved me from crashing a site at least once. I got a bit sloppy on a dev WordPress site and did something to the wp-config PHP file that crashed the site. Yikes! It could have been anything from a missing semi-colon to a misspelled word. Hard to say, but the site was totally dead. Instead of spending a lot of valuable time poring over the file to find the typo, I executed a simple command:
sudo git checkout wp-config.php
The one area of consternation I’ve had with Git has been with submodules. The previous Moodle admin at my school set-up a submodule system to manage all of the various plugins we run (50 or so at last count). In theory this should make managing a suite of plugins easier, but in practice I’ve struggled with submodules, at least in terms of using them at all efficiently, as they make the git process a bit more complicated conceptually. However I am starting to get the hang of submodules now and and getting clarity on how they function in relation to the “
Photo by Fatos Bytyqi on Unsplash