Git is the time machine for your drupal back-end agile shenanigans
working with code is not unlike a sci-fi adventure: you're time traveling¹ one time, and visiting parallel universes² next. either solo or with your buddies, it sometimes feels like a race to the finish line, with the stakes mounting higher and higher as the deadline approaches.
but even as challenges grow to epic proportions or advance at ludicrous speed, one thing's for certain: the right tool can save your day.
and that tool, for us, is Git.
(I mean come on, of course you knew where this was going (didn't you?) )
so anyway, I've recently found myself having to tidy up a change that I had previously made. so much for perfectionism…
a view was not displaying the correct value on a table that very much needed it to. after discussing the issue with my PO, the UX, and the manager, we found out that there had been a slight oversight on behalf of… well, everyone.
now I'm grateful to be working on a project with some excellent people. there was no finger-pointing: we just knew we had missed a spot, so we discussed how best to fix it, and then it naturally was on me to find the bug and squash it.
for good.
that's when it got tricky, because code-wise I knew I had the right view — and display — but the change just wouldn't stick.
that's where GitLab comes in handy.
you can go to Code > Commits and filter the list by your name, which brings up all of your changes in chronological order.
another useful section is Merge requests > Merged (because I knew the commit had been approved). again you can filter by your name and check your own recent contributions.
or, if you know exactly what you're looking for, go to the branch where everything was merged, locate the file, and switch to the Blame view: you can now see which lines you've shape-shifted into something else.
you can also try investigating in Terminal, if you're feeling particularly adventurous:
$ git blame - your_file.txt | grep 'your.username'any of these techniques should give you a pretty decent clue.
in my case, well, I had a hook in a module and another one in the theme. the theme hook dealt specifically with field rendering. I'm thinking I should streamline my work, give it more consistency…
like you do. *nudge nudge feat. wink
but in my defense, everything had comments. thank you, Luciano from the past!
¹ looking for that one commit you did a while ago
² browsing all the branches for that one miraculous piece of code someone introduced to the repo
Originally published at https://linkedin.com on December 10, 2024.