Using Git properly
Posted on 10 December, 2017
I've spent the last three weeks (amongst other things) updating the LSERSA (London & South East Regional Snowsports Association) website.
The old site (which stretches back to 1998 — I've been running it since 2014) had a massive archive of race results and news articles that we were desperate to 'hide', and (although I gave it a visual refresh when I took it over) was outdated, confusing and not very engaging.
I've had the go-ahead for several months to do a refresh, but it took until late November for me to find the time and energy to work through the issues.
In no particular order, the brief was:
- freshen up the overall design to make the site more modern (and, not incidentally, help potential sponsors understand what we do)
- get rid of the huge backlog of historic information ...
- whilst keeping it available for those who need it ...
- and ensuring that any external links (which could be to any page or resource) continued to work
To keep the site manageable from a file-system viewpoint I also was keen to move any 'archived' information into sub-folder(s) — I (and my predecessor) hadn't really had a constant approach to file structure, so there were a large number of pages and resources that sat in the root directory, making it harder (or at least "not so obvious") to keep the site up-to-date.
Enter Git
To date, my use of Git has primarily been around ensuring that a copy of my code is available on GitHub (or occasionally Bitbucket). I'd run through the Learn Enough Git To Be Dangerous tutorial (which I highly recommend) amongst others, so understood some of its wider capabilities, but had never used them.
But when you want to make fundamental changes to a website, including a bunch of structural edits and external redirects, whilst still being able to publish to the existing site — well, Git to the rescue.
By creating a new branch of my project and experimenting there, I was able to get a working version
of the replacement site — which entailed moving nearly 10,000 files, updating several thousand
internal links and over 50 new server redirects (RedirectMatch to the rescue) in addition to
creating an updated style and writing the 'copy' for the replacement site — up and running, with a
minimum of fuss. Once I'd done enough testing to be confident everything worked, just had to merge
those changes back to the master branch and then re-publish the site (which is a different story,
I haven't found the right toolset for remote syncing yet ...)
None of this is revolutionary (and anyone who's experienced with Git will be rolling their eyes that anyone feels the need to write about such a trivial use-case!) but felt it was worth putting it out there.